Excel users frequently want to calculate age from date of birth. You can do this with a few simple steps in Easy Data Transform:
Install Easy Data Transform on your PC or Mac, if you haven’t done so already. It will only take a minute. There is a fully fuctional free trial and you don’t have to give us your email or sign up to anything.
Start Easy Data Transform.
Drag the Excel spreadsheet with the dates of birth onto Easy Data Transform. If there are multiple sheets, you will be asked which one to input. A pink input item will be added.
You now need the date in ISO format for the calculation. Ensuring the appropriate pink input item is selected, click the Date Format button in the left pane.
yyyy-MM-dd
. The date of birth column should now change to the new format. Your original spreadsheet has not been changed.Ensuring Date Format transform is selected, click the Javascript button in the left pane. You may need to scroll the left pane to see it.
The Javascript transform is added and selected. In the right pane set New column name to Age and Javascript to the following:
return new Date() - new Date( $(DOB) );
But replace DOB with the name of your date of birth column. Click Evaluate. The Age column should now show the difference (in milliseconds) between the current date and the date of birth.
Ensuring Javascript transform is selected, click the Units button in the left pane.
The Units transform is added and selected. In the right pane check the Age column and set Dimensions to Time, From to Milliseconds and To to Years. Age is now shown in years.
Ensuring Units transform is selected, click the Num Format button in the left pane.
The Num Format transform is added and selected. In the right pane check the Age column, set Format to f and Precision to 0.
The Excel file is created immediately at the chosen location, no need to ‘run’ anything. It will be updated any time you change something ‘upstream’.
File>Save this series of transformations if you might want to use it again.
Easy Data Transform allows you to combine multiple transforms to quickly and easily create many different data transformations. If you have large number of files to convert you can do it using the batch processing feature.
v1.13.1 for Windows 10 / 8 / 7 (30 MB)
v1.13.1 for Mac 11.1 to 10.13 (31 MB)
Questions or problems?
Do you have a question?
We would love to help.
This pop-up will not be shown again