Convert birthday to age in days

To convert a date of birth to age, in days, we can apply the Excel DATEDIF and NOW functions

Example: Convert birthday to age in days

Convert birthday to age in days

METHOD 1. Convert birthday to age in days

EXCEL

=DATEDIF(B5,NOW(),"d")
The formula returns the number of days from the specified date, which is the birthdate that we selected in this example, to the current date that is specified by the Excel NOW function.

METHOD 1. Convert birthday to age in days using VBA

VBA

Sub Convert_birthday_to_age_in_days()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
Set date1 = ws.Range("B5")
'convert the birthdate to age in days
ws.Range("C5") = DateDiff("m", date1, Now)

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named Analysis.
Birthday: If using the exact VBA code the birthday needs to be captured in cell ("B5").

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("C5") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.
Birthday: Select the cell that captures the birthday by changing the cell reference ("B5") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.

METHOD 2. Convert birthday to age in days using VBA with a formula function

VBA

Sub Convert_birthday_to_age_in_days()
'declare variables
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'convert the birthdate to age in days
ws.Range("C5").Formula = "=DATEDIF(B5,Now(),""d"")"

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named Analysis.
Birthday: If using the exact VBA code the birthday needs to be captured in cell ("B5").

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("C5") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.
Birthday: Select the cell that captures the birthday by changing the cell reference ("B5") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.

Explanation about the formula used to convert birthday to age in days

EXPLANATION

EXPLANATION
To convert a date of birth to age, in days, we can apply the Excel DATEDIF and NOW functions. If using VBA, we either use a DateDiff function or apply the DATEDIF formula.
FORMULAS
=DATEDIF(birthdate,NOW(),"d")

ARGUMENTS
birhtdate: The birthdate of the person who's age you want to calculate.