Excel formula to calculate date difference in years and months - excel

I'm trying to come up with an Excel formula that will calculate the difference in years and months between a date in the past and today.
For example, the following tells me the number of days between a cell and now:
=INT((TODAY()-C2))
But I then need to format that value as Year and Month(s).
Obviously I'm no expert in Excel and appreciate any help!
Thanks in advance,
Dan

Alas, what I did was a simple diff and got a result in year and percent, which will work fine:
=((TODAY())-(D2))/365
The DATEDIF was a total disaster, with really odd, inconsistent results.
Thanks for all the suggestions though!

Looking at the Microsoft Office knowledgebase, I see a YEAR function that may be used:
A1: 1-Jan-2014
A2: 4-Dec-2016
A3: =YEAR(A2)-YEAR(A1) # will yield 2

Related

How to calculate number of days in Excel

I have a date format like 2020-01-17.I would like to calculate number of days till today date. I'm trying it's like
=today() - B2
However it's not working.
Edit
I changed the format to 01/17/2020 and did
=today() - B2
The result comes as 3/23/1900.
This is wrong and I would like to see in number of days.
very simple
Check Out Image enter image description here
I think there are 2 issues that you're seeing here.
The result comes as 3/23/1900.
The reason you're seeing this result as 3/23/1900 is probably because of the format of the cell. Change cell format to number and you should see your result as a number.
Or you can also use the formula with a VALUE formula like so =VALUE(today() - B2)
I would like to calculate number of days till today date
You can always use a simple subtraction of the two dates.
You can also use the DATEDIF function and extract the difference between dates in Years, Months, Days and more. Example: =DATEDIF(today(), B2,"D")
Here is the documentation for this DATEDIF function.
Note: Below is the warning from Microsoft
Warning: Excel provides the DATEDIF function in order to support older workbooks from Lotus 1-2-3. The DATEDIF function may calculate incorrect results under certain scenarios. Please see the known issues section of this article for further details
You can you use the datedif fx link: https://exceljet.net/excel-functions/excel-datedif-function
=DATEDIF(B2,TODAY(),"D")

Excel (if statement, maybe?) Birthday List or Vlookup

Hello I am trying to use a simple excel sheet (last name, first name, date of birth, date of hire) for an employee listing to then create a list of birthdays (pro[bably +/- 7 days) - just the last & first name. Secondly the same thing for the hire date (probably +/- 14 days) and the years of service, that calculation I figured out easily.
I was trying to do this with if statements or datedif and am struggling.
maybe this isnt the proper tool, any thoughts, suggestions would be greatly appreciated!
Please see sample data screen shot below:
expected output:
Maybe this would be better as a vlookup?
Thank you
OK, so here is what I came up with based on my understanding of the question:
=IF(OR(DATEDIF(B2,TODAY(),"YD")<=7,DATEDIF(B2,TODAY(),"YD")>=359),A2,"NO")
The formula here takes number of days between the birthday and today (ignoring the years) and checks if they're less than or equal to 7 or more than or equal to 359.
Sample spreadsheet: https://www.dropbox.com/s/kxgi9eeoikems66/Birthday.xlsx?dl=0
Insert two more columns for month of birth and month of hiring. Add the following formula in both consecutively
=TEXT(C1,”MMMM”) and =TEXT(D1,”MMMM”)
The final sheet will look like this
After that select all of your data and insert Pivot table and format it like the below
You will get an auto updatable sheet without any macros and extra work

Leap year EOM excel formula

I am trying to extract one year from this date 29/02/2020 and should be getting this 28/02/2019, but I am getting this 31/03/2019. I have the following formula =TEXT(EOMONTH(DATE(YEAR(G1)-1,MONTH(G1),DAY(G1)),0),"DD/MM/YYYY"), can someone tell me what I need to add to this formula so that it takes into account leap years.
Would this be okay with you:
=TEXT(EOMONTH(G1,-12),"DD/MM/YYYY")

Average of dates between many years

I have a problem with calculation in Excel of average date (just need day and month) between dates of many years.
I tried this function:
=AVERAGE(IF(MONTH(D5:D56)=9;DATE(2010;9;DAY(D5:D56))))
Apparently, it just gave me average date of year 2010.
Please for any good advice.
Does this array formula do what you want?
=AVERAGE(DATE(2010,MONTH(D34:D56),DAY(D34:D56)))
Be sure to enter it using Ctrl-Shift-Enter.

Compare if year in date is prior to today's year

I have a date in the format of "4/26/2013". I want to see if that date is prior than the current year, whatever that current year may be (don't want to hardcode 2013) and count how many of the rows match that criteria. Say there are 6 rows of dates in that format:
=COUNTIF(C2:C7, YEAR(Today()))
This threw an error. I'm new to Excel, so I probably made a huge mistake! Can anyone see what is wrong with this?
Thanks!
If C2:C7 contain dates you need to compare them to the 1st of January in the current year, e.g.
=COUNTIF(C2:C7,"<"&DATE(YEAR(TODAY()),1,1))
or you can use SUMPRODUCT like this
=SUMPRODUCT((YEAR(C2:C7)<YEAR(TODAY()))*(C2:C7<>""))
I just figured it out. My syntax was wrong. The answer to the above example was:
=COUNTIF(C2:C7, ">"&YEAR(TODAY()))
That returned the number of dates in C2 - C7 that were prior to the current year.

Resources