Date Comparison error

DPChristman

Board Regular
Joined
Sep 4, 2012
Messages
139
I have a strange error that I am running into with trying to determine the age of an employee.

The formula I have in place is =SUM(NOW()-H5)/365, where H5 is the date of birth.

The formula works most of the time, but then I get these odd incorrect responses.

I have added multiple decimal points to try and get the age as accurate as possible, and still getting these errors.

Example using today's date (10/26/2020), and a birth date of 11/1/1990, the formula returns a value of 30.007.

This is clearly wrong. Does anyone know a fix or have a better formula for this?
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,549
Office Version
  1. 365
Platform
  1. Windows
Use Today & not Now.
Now returns the data & time, where the time value is a decimal fraction.
Also there is no need to use sum in that formula.
 

DPChristman

Board Regular
Joined
Sep 4, 2012
Messages
139
Use Today & not Now.
Now returns the data & time, where the time value is a decimal fraction.
Also there is no need to use sum in that formula.
=(TODAY()-H2)/365 is still giving me the same result, though the decimal point has changed slightly
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,549
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Do you just want to take into account the year they were born?
If so use
Excel Formula:
=YEAR(TODAY())-YEAR(H5)
 

DPChristman

Board Regular
Joined
Sep 4, 2012
Messages
139
Do you just want to take into account the year they were born?
If so use
Excel Formula:
=YEAR(TODAY())-YEAR(H5)
It has to be somewhat specific. I am running backgrounds, and the results are grouped by age (years old), so if I am dealing with a fairly common name. and the result should be 29, the formula returns 30, which can equal hundred of responses.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,549
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

I'm afraid I don't see where someone's name comes into calculating their age. :confused:
What exactly are you trying to get?
You don't seem to want a decimal portion, nor do you seem to want a whole number.
 

DPChristman

Board Regular
Joined
Sep 4, 2012
Messages
139
I'm afraid I don't see where someone's name comes into calculating their age. :confused:
What exactly are you trying to get?
You don't seem to want a decimal portion, nor do you seem to want a whole number.
If I am looking for John Smith with a default age of 30, when in fact is should be 29.XXX, that will create a lot of false positives. If the year was accurate, that would be good. However, for example 2020-1990 is 30 years, but doing the search today, 2020 (now or today in the formula) - November 3rd, 1990 is 29 years However, the result I am getting is 30.000, which is wrong.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,549
Office Version
  1. 365
Platform
  1. Windows
I'm sorry but I still don't understand what you are trying to calculate.
Do you want a whole number of years or a fraction?
 

DPChristman

Board Regular
Joined
Sep 4, 2012
Messages
139
I'm sorry but I still don't understand what you are trying to calculate.
Do you want a whole number of years or a fraction?
For the purpose of the search, the whole year is fine, but the issue is the formula is returning (example) 30, when the person is 29. Specifically when looking at days days that are close to today. If someone's DOB in 11/3/1990, they are not 30 years old, they are 29 years old.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,594
Messages
5,625,688
Members
416,127
Latest member
MALEPINZON

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top