Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default changed DOB to age, but if no DOB need cell to be empty.

I am using this formula: in Excel 2007
=DATEDIF(A1,TODAY(),"y") & " years, " & DATEDIF(A1,TODAY(),"ym") & " months,
" & DATEDIF(A1,TODAY(),"md") & " days"

will give age. for example if A1 contains:
1/15/1985
the formula will return in A2
21 years, 8 months, 15 days

Question: If I don't have a date in A1 what do I need to add to formula to
keep A2 blank until a date is added to A1?

I would also like to color code the age broke down in ranges birth-4 months,
5-8 months, 9-12 months, 1yr, 2yr,3 yr, 4yr and 5 years old. So that it
changes as they age. Is this possible?

Thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default changed DOB to age, but if no DOB need cell to be empty.

=IF(A1="","",DATEDIF())

(your material in the DATEDIF(), of course)
--
Gary''s Student - gsnu200810
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default changed DOB to age, but if no DOB need cell to be empty.

I was hoping you would answer becasue it was you who wrote the formula I am
using. Now I'm confused with , do I add this to the orginal formula? If soI
am getting a error in doing so.

"Gary''s Student" wrote:

=IF(A1="","",DATEDIF())

(your material in the DATEDIF(), of course)
--
Gary''s Student - gsnu200810

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default changed DOB to age, but if no DOB need cell to be empty.

Try this:

"=IF(A1="""","""",DATEDIF(A1,TODAY(),""y"")&"" years,
""&DATEDIF(A1,TODAY(),""ym"")&"" months,
""&DATEDIF(A1,TODAY(),""md"")&"" days"")"

just be careful of the text wrapping.
--
Gary''s Student - gsnu200810


"melcook1" wrote:

I was hoping you would answer becasue it was you who wrote the formula I am
using. Now I'm confused with , do I add this to the orginal formula? If soI
am getting a error in doing so.

"Gary''s Student" wrote:

=IF(A1="","",DATEDIF())

(your material in the DATEDIF(), of course)
--
Gary''s Student - gsnu200810

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 348
Default changed DOB to age, but if no DOB need cell to be empty.

Gary''s Student wrote:
Try this:

"=IF(A1="""","""",DATEDIF(A1,TODAY(),""y"")&"" years,
""&DATEDIF(A1,TODAY(),""ym"")&"" months,
""&DATEDIF(A1,TODAY(),""md"")&"" days"")"

just be careful of the text wrapping.

If you are really Gary's Student, Gary did an excellent job!

Bill
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format changed when the details in cell changed angel Excel Worksheet Functions 9 July 15th 08 12:36 AM
When is a cell empty and how do I empty it. C Brandt Excel Discussion (Misc queries) 5 August 13th 07 05:37 PM
Leaving an empty cell empty GRL Excel Discussion (Misc queries) 4 April 22nd 06 05:47 PM
why a reference to an empty cell is not considered empty Nicoscot Excel Discussion (Misc queries) 10 March 10th 06 05:36 AM
in vba what command is used to determine if a particular cell on a particular sheet changed? some kind of event? how to get the old and new value of the cell? Daniel Excel Worksheet Functions 1 June 23rd 05 07:53 PM


All times are GMT +1. The time now is 11:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"