How to substract a date in excel to 2000

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to get exact date (day/month/year) of a person as to when he will be
21 years of age in excel to 2000

eg. My birthdate is 12/12/1972 - 12/12/1993 = 21 years
the output should be in years as shown in eg.
 
function years21(birthdate as date) as string
on error goto error_line
dim newdate as date
newdate = dateserial(year(birthdate)+21,month(birthdate),day(birthdate))
years21="My birthdate is " & _
format(birthdate,""dd/mm/yyyy") & " - " & _
format(newdate,""dd/mm/yyyy") & " = 21 years"
exit function
error_line:
years21="Error"
end function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top