Calculate Birthdate from an age using y,m,d in Excel

Viewed 1488

Is it possible to create a formula to obtain the birth date from an age?

Age = 14d, 3m, 55y
Today = 13/01/2021
Birthdate = ?
2 Answers

With a date in A1 and an age-string in B1 like:

enter image description here

First enter the following User Defined Function in a standard module:

Option Explicit
Public Function BirthDay(d As Date, age As String) As Date
    Dim v As String, arr, tDate As Date
    
    v = Replace(age, "y", "")
    v = Replace(v, "m,", "")
    v = Replace(v, "d,", "")
    
    arr = Split(v, " ")
    tDate = DateAdd("d", -arr(0), d)
    tDate = DateAdd("m", -arr(1), tDate)
    BirthDay = DateAdd("yyyy", -arr(2), tDate)
    
End Function

and in C1 enter:

=birthday(A1,B1)

Format C1 as you require. Here is an example with UK formatting:

enter image description here

EDIT#1:

To check the answer, we can use the DATEDIF() function. In D1 enter:

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

enter image description here

which re-constructs the age-string in B1. 30 September 1965 makes sense intuitively:

enter image description here

(US format above)

Try this formula in cell E2 (in my example):

=A2-(B2*365.25+C2*30.4375+D2)-1

see the below screenshot for the whole example:enter image description here

Related