Avatar of Matt Pinkston
Matt Pinkston
 asked on

Age between two dates

I have a spreadsheet where column b is the birthdate and I need to determine the age of the person relative to august 31 of 2011.
Microsoft Excel

Avatar of undefined
Last Comment
Cluskitt

8/22/2022 - Mon
Cluskitt

=2011-YEAR(B1)-IF(MONTH(B1)>8,-1,0)
Cluskitt

Change the -IF to +IF
Or change the -1,0 to 1,0 in the if.
Either way should work
Matt Pinkston

ASKER
it comes back with a werid date 1/12/1900

I was hoping for just how of the indivudal was as of 8/31/2011
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
wshark83

assuming you had DOB = 31-Aug-83 (A1) and compared against 31-Aug-11 (B1)

You get 28 years  do =(B1-A1)/365 and format the cell as number 0 dp

remeber both columns (A1&B1) need to be in date format

alternatively you can also do :

=(DATE(2011,8,31)-A1)/365
Matt Pinkston

ASKER
8/31/2011 is just a know date for all it is not a column I need to know the age of a person as of 8/31/2011
wshark83

=(DATE(2011,8,31)-A1)/365  will get you the result you require as long as you format the cell as number 0 dp....

where A1 = the cell where DOB is held for all
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Rory Archibald

=DATEDIF(B2,date(2011,8,31),"y")
for example. Format as Number if you see a strange date.
ASKER CERTIFIED SOLUTION
Cluskitt

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Rory Archibald

>>"Doing a simple DATEDIF for year won't work, because it would return '12/31/2010' as 1 year old, when it should return 0."

did you test that? returns 0 for me.
Cluskitt

My apologies. It does seem to work. I had the feeling that it didn't work before. I know it doesn't work for SQL and I was almost sure it didn't in excel. Maybe in some previous version?
Either way, your formula works properly, so I apologize.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck