View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
R.VENKATARAMAN R.VENKATARAMAN is offline
external usenet poster
 
Posts: 110
Default Convert Date to Age

try to use this function in vba

DateDiff("yyyy", Range("a1"), Now)

if a1 is before 1930 use all the four figures of the year in entering the
date in A1

see also help datediff in vba


jnlns wrote in message
...
I have been asked to create a report that allows for both age and/or
birthdate. Well if I have the age, the report works fine, however there

are
some instances that I only have the birthdate, how would I convert that

date
to age in the vba application and populate it into the age field.

Same text is

Column 2, row 2 is birthdate,
column 2, row 3 is age

I am assuming that an if...else loop would apply, but can't seem to get it
working.