=EOMONTH(A2,0) returns the last day of the month that contains the date in A2. If A2 is any date in March 2026, the result is March 31, 2026. Format the cell as a date, or it shows a number.
Last day of another month
The second argument moves the result forward or back by whole months. 1 returns the last day of the next month, and -1 returns the last day of the previous month. For a date in March 2026, =EOMONTH(A2,1) returns April 30, 2026.
Without EOMONTH: DATE with a day of 0
=DATE(YEAR(A2),MONTH(A2)+1,0)
A day of 0 means the last day of the previous month. The formula asks for day 0 of the month after the one in A2, so the result is the last day of the month in A2. This works in any version of Excel. The DATE function is covered in more detail in excel date function from year month day.
First day of the month
Use EOMONTH and add 1:
=EOMONTH(A2,-1)+1
Or use DATE with a day of 1: =DATE(YEAR(A2),MONTH(A2),1). Both return the first day of the month in A2.
How many days are in the month
Wrap the EOMONTH formula in DAY:
=DAY(EOMONTH(A2,0))
The result is 28, 29, 30 or 31. February 2026 returns 28. February 2028 returns 29, because 2028 is a leap year. A year is a leap year if it divides evenly by 4, except century years, which must also divide evenly by 400. So 2100 is not a leap year.
Fill the formula down a column
If dates are in A2 through A20, put =EOMONTH(A2,0) in B2 and copy it down. Each row then returns the last day of its own month, because A2 moves down with the copy. If A2 is already the last day of its month, the result is the same date.
Common problems
- The result shows as a number. Format the cell as a date.
- #VALUE! appears. The date in A2 is probably text. How to fix #value error in excel covers the checks.
- The result is one month off. Check the months argument. 1 means next month, and -1 means the previous month.
Where to go next
Month ends are useful for monthly reports, invoices and budgets. Check one or two months by hand, including February in a leap year, before you copy the formula down a long list.