Leap year EOM excel formula - excel

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")

Related

Excel month formula

I want to show specific text for whether something is due for any given month in a financial year or overdue if that month has passed. The formula I am using is as below and works fine until I get to January.
I am using the numerals 7-12 in this formula to represent respective month but am unsure how to ensure the number 1 relates to the next year. For that matter I guess my equation below for overdue for December won't work either.
=IF(MONTH(TODAY())=12,"DUE",IF(MONTH(TODAY())<=12,"",IF(MONTH(TODAY())>=12,"Overdue")))
Any help would be appreciated
Instead of the month number, let A1 equal the first of the month in which it's due. (Note the first of the month is what you'll get if you just type in the month and year, eg August 2014)
=IF(TODAY()<A1,"",IF(TODAY()>EOMONTH(A1,0),"Overdue","Due"))
Here is a solution that you can use. This includes a =YEAR( function and an =AND function to extend on what you already have.
The formula you can use is here.
=IF(AND(MONTH(TODAY())=MONTH(A2),YEAR(TODAY())=YEAR(A2)),"Due",IF(AND(MONTH(TODAY())>MONTH(A2),YEAR(TODAY())>=YEAR(A2)),"Overdue",""))
you can add the year into the comparison which will eliminate your problems with January.
Just wrap the month check and year check in an =AND( function when both conditions are TRUE you can enter your result.

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.

How to get excel to update the year each year?

Currently I am trying to get my Excel spreadsheet to update the age of people as the dates come around. For example, this year I am 20 years old and my birthday is 03/03/1994. I want Excel to be able to change my age to 21 on 03/03/2015 and change it to 22 on 03/03/2016.
I was thinking a formula that involves taking the date of birth and subtracting it from the current date but I don't know how to get excel to update that current date.
This is so that I don't have to go in and change each person's age whenever they have a birthday.
The simple answer to your question is =now() or =today()
However there is a formula in excel called =DATEDIF() (literally date dif ference)
This takes three arguments (in context):
Past Date/Birthdate
To Date/Today
Interval Type (full years in this case)
So the formula can be written like this:
=DATEDIF(DATEVALUE("01/01/2001"),TODAY(),"y")
This gives you an answer in whole calendar years
You could of course replace DATEVALUE("01/01/2001") with a cell reference
=DATEDIF(VALUE(A1),TODAY(),"y")
Pick a cell and enter:
=DATEDIF(DATEVALUE("3/3/1994"),TODAY(),"y")

Excel formula to calculate date difference in years and months

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

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