The shortest working formula for the last day of the previous month is =EOMONTH(TODAY(),-1). If you are starting from a specific date in, say, cell A2, use =EOMONTH(A2,-1). The EOMONTH function returns the final day of a month a given number of months before or after a start date, so a second argument of -1 steps back exactly one month and lands on its last day. The result is a real date serial number, so Excel displays it as a date (for example 31 October 2026) and you can sort, filter or calculate with it. Nothing needs installing or enabling first, but check that your date cells are actual dates rather than text, because EOMONTH will return an error on text.
What You'll Need
- A version of Excel that includes EOMONTH. It is built into Excel for Microsoft 365, Excel 2019 and later, and Excel for Mac from 2011 onward, so almost any current copy will work. Excel 2007 needed the Analysis ToolPak add-in, and very old files may still reference that.
- A cell containing either a real date or a formula that produces one, such as TODAY().
- An empty cell for the result, ideally formatted as a date (Short Date or a custom format) so the answer is readable.
Step-by-Step
- Click the cell where you want the answer to appear. This will be a formula cell, not the cell holding your starting date.
- Type
=EOMONTH(and then click the cell that holds your reference date. The reference appears in the formula, for example=EOMONTH(A2,. - Type a comma, then
-1, then a closing bracket. The full formula reads=EOMONTH(A2,-1). The -1 means "one month before the reference date, then the end of that month." - Press Enter. The cell shows the last date of the prior month. For a reference of 15 March 2026, the result is 28 February 2026; for 1 January 2026, the result is 31 December 2025, so the year rolls back automatically.
- If you always want last month relative to today, replace the cell reference with TODAY():
=EOMONTH(TODAY(),-1). This updates every time the workbook recalculates or is reopened. - Right-click the result cell, choose Format Cells, and pick a date format. If the cell shows a five-digit number like 46387, it is formatted as General; changing the format to Date fixes the display without touching the formula.
- Drag the fill handle down to apply the same formula to a whole column of dates. Relative references adjust per row while the -1 argument stays fixed.
- Optional: if you need the start of last month as well, use
=EOMONTH(TODAY(),-2)+1. It finds the end of two months ago and adds one day, giving the first day of the previous month. - Optional: to confirm a date really is the month end, compare it to
=EOMONTH(A2,0). If the two match, A2 is the last day of its month. - Save the workbook. Formulas recalculate on open, so the TODAY() version stays current without any manual editing.
Common Mistakes
- Using 0 instead of -1. A zero means "end of the current month," not the previous one. Mixing these up produces a date a month too late.
- Subtracting 30 days. A formula like
=A2-30does not give the month end; February, 31-day months and leap years all break it. EOMONTH handles those cases correctly. - Dates stored as text. If your reference was pasted from another system, it may be text. EOMONTH then returns a #VALUE! error. Watch for left-aligned dates and use Data > Text to Columns or DATEVALUE to convert them.
- Formatting the result as General. The formula works but shows a serial number. It looks wrong even though it is right.
- Missing EOMONTH entirely. Excel returns #NAME? when the function is not recognised, usually because the workbook was created in a very old version without the Analysis ToolPak.
- Hard-coding dates in text. Typing "last day of last month" into a cell does nothing; only the formula produces a value.
Tips
- Use EOMONTH rather than subtracting a day from the first of the next month. It is shorter and avoids off-by-one errors around December and leap years.
- Combine with TEXT to label reports:
="Month ending "&TEXT(EOMONTH(TODAY(),-1),"d mmm yyyy")gives a tidy heading. - For a fixed month-end rather than the previous one, pass a positive or zero second argument, such as
=EOMONTH(A2,1)for the end of the following month. - Keep the reference date and the formula in separate cells so you can change one without breaking the other.
- If your report is monthly, put the formula in a header cell and reference it elsewhere; one change then updates the whole sheet.
Troubleshooting
If the result is #VALUE!, the reference cell almost certainly holds text rather than a date, or contains an error value itself. Select the cell and check its alignment and the number format; a real date is right-aligned by default. Convert text dates with Data > Text to Columns, choosing the date format that matches your data, or with =DATEVALUE(A2).
If the formula returns #NAME?, the EOMONTH function is not recognised. In modern Excel this is rare; in legacy files, go to File > Options > Add-ins, manage Excel Add-ins, and enable Analysis ToolPak. In Excel for the web, EOMONTH is available, so a #NAME? there usually means a typo in the function name.
If the result looks like a number, apply a date format. If it shows the wrong month, recheck the second argument: -1 is last month, 0 is this month, 1 is next month. If the year looks wrong, check whether the reference date itself has the wrong year, which is common when dates are typed with two digits.
If dragged formulas give the same answer in every row, you likely used absolute references. Remove the dollar signs so the reference changes per row. If the answer does not refresh, press F9 to force recalculation, or check that calculation is set to Automatic under Formulas > Calculation Options.
Frequently Asked Questions
What does EOMONTH actually return?
A date serial number representing the last day of a month, offset by the number of months you specify. Formatting it as a date makes it readable.
Can I get the last day of last month without EOMONTH?
Yes: =DATE(YEAR(A2),MONTH(A2),0) returns the last day of the month before the date in A2, because day zero means the day before the first of that month. It is longer but works on very old versions.
Does EOMONTH handle February and leap years?
Yes. It knows the length of every month, including 29 February in leap years, so you never get an invalid date like 30 February.
Why does my formula show a five-digit number?
Excel stores dates as serial numbers. Change the cell format to Date and the number becomes a readable date.
Will it update automatically next month?
Only if you use TODAY() inside the formula. A reference to a fixed date cell stays put until you change that cell.
Is EOMONTH available in Excel for the web and Google Sheets?
Yes, both support EOMONTH with the same syntax, so formulas usually carry over between them.