Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel datedif function help 1

Status
Not open for further replies.
Mar 26, 2001
20
US
I use the datedif function =DATEDIF(C4,"2002/8/1","Y")in column D4 to tell me how old a kid will be on 8/1/2002. C is the column that contains birthdays and D is the column that contains ages. It works fine except if the cell is empty then 102 is returned. My question is how can I write it so that if in this case C4 is empty D4 will also be empty and not 102? Also as a side note why would 102 show up and not a "normal" error?
 
copedigger,

Enter the formula below to eliminate the number 102 from displaying when applying the formula for a blank cell:
=IF(C4="","",DATEDIF(C4,"2002/8/1","Y"))

The reason you are receiving 102 is because you are applying a date formula and Excel is interpreting the blank space as the beginning day and year for dates in the program or 1/1/1900. The formula calculates the difference in years from this date, hence you receive 102, since it has been that long in years since that date.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top