To get the last day of the previous month in Excel, use the EOMONTH function: =EOMONTH(A1,-1), where A1 holds any date in the current month. EOMONTH always returns the final calendar day of a month, and the -1 argument tells it to look one month back. That single formula replaces messy combinations of DATE, YEAR and MONTH, and it handles February, leap years and 31-day months automatically. If you need the previous month's end based on today's date rather than a cell, wrap TODAY() inside it: =EOMONTH(TODAY(),-1).

What You'll Need

  • Microsoft Excel (any modern desktop or Microsoft 365 version). EOMONTH is built in and needs no add-in.
  • A cell containing a valid Excel date, or permission to use TODAY().
  • Basic familiarity with typing a formula and pressing Enter.

Note that EOMONTH is part of the standard function library in all current Excel versions, so you should not see a #NAME? error unless the formula is misspelled. Labels and dialog wording can differ slightly by Excel version, device and region.

Step-by-Step

  1. Put a reference date in a cell. Click cell A1 and type a date such as 3/15/2025, then press Enter. Excel converts it to a real date value. If Excel shows it as text on the left side of the cell instead of right-aligned, re-enter it in a format Excel recognises.
  2. Confirm the cell holds a date, not text. Click A1 and look at the Number Format box on the Home tab. It should show something like Date or Short Date. If it shows Text, select the cell, open Format Cells (Ctrl+1), choose Date and click OK, then retype the date.
  3. Click an empty cell for your result, for example B1.
  4. Type the formula: =EOMONTH(A1,-1) and press Enter. The -1 means one month before the month of A1, and EOMONTH snaps to that month's last day. For 3/15/2025 the result is 2/28/2025.
  5. Check the result's number format. The output may appear as a serial number like 45716 if B1 is formatted as General. With B1 selected, press Ctrl+1, choose Date, pick a format and click OK. The serial number now displays as a readable date.
  6. Use today's date when you do not have a reference cell. In any cell type =EOMONTH(TODAY(),-1) and press Enter. This always returns the last day of the month before the current one, refreshing each time the workbook recalculates.
  7. Copy the formula down a column if needed. Drag the fill handle from B1 downward. Because A1 is a relative reference, each row will calculate the prior month end for its own date in column A.
  8. Format the result as a clean date string if you need it in a report. Wrap the formula in TEXT: =TEXT(EOMONTH(A1,-1),"mmmm d, yyyy"). For 3/15/2025 this returns "February 28, 2025". Use this only for display, because the TEXT result is text, not a date you can calculate with.
  9. Get the prior month end relative to a fixed month-end date. If A1 already holds a month-end such as 3/31/2025, EOMONTH(A1,-1) still returns 2/28/2025, because EOMONTH works from the month of the supplied date, not its exact day. This makes it safe to feed in either a mid-month or month-end reference.

Common Mistakes

  • Using EOMONTH(A1,0) by mistake. A zero argument returns the end of the same month, not the previous one. Use -1 for last month and -2 for two months back.
  • Passing a text date. If A1 contains "March 15, 2025" stored as text, EOMONTH returns #VALUE!. Convert it to a real date first.
  • Leaving the result formatted as General. A five-digit number like 45716 is a valid date serial, but readers will not recognise it. Apply a Date format.
  • Subtracting 30 days instead of using EOMONTH. A1-30 lands on an arbitrary date, not the month end, and can produce wrong results in short months. EOMONTH is the correct tool.
  • Forgetting that TEXT output breaks calculations. Subtracting two TEXT results returns an error or a meaningless value. Keep a real date column and a separate display column.
  • Assuming EOMONTH works in every spreadsheet app. It exists in Excel and most modern alternatives, but some older or web-based tools may not support it. If you see #NAME?, check the tool's function list and fall back to DATE(YEAR(A1),MONTH(A1),0), which returns the last day of the month before A1.

Tips

  • Use a negative second argument to move backwards and a positive one to move forwards: EOMONTH(A1,1) gives the end of next month.
  • To get the first day of the prior month instead, use =EOMONTH(A1,-2)+1. Moving back two months to the month end and adding one day lands on day one of the prior month.
  • Name your reference cell (for example, select it and type a name in the Name Box) so formulas read clearly, like =EOMONTH(ReportDate,-1).
  • If your workbook recalculates slowly with many TODAY() formulas, consider putting TODAY() in one cell and referencing it, rather than repeating the function in dozens of cells.
  • Lock the reference cell with dollar signs (=EOMONTH($A$1,-1)) when copying across columns so the reference does not shift.

Troubleshooting

The formula returns #VALUE!. The reference cell is almost certainly text or empty. Check its alignment and Number Format, retype the date in a recognised format such as 3/15/2025 or 2025-03-15, and press Enter again.

The formula returns a number like 45716. This is not an error; it is Excel's date serial. Format the result cell as a Date using Ctrl+1.

You see #NAME?. Confirm the spelling is exactly EOMONTH with the opening and closing parentheses. If you are in a different spreadsheet application that lacks the function, switch to the DATE fallback described above.

The result is the end of this month, not last month. Check the second argument. A 0 gives this month's end; -1 gives last month's end.

If that did not work, click the cell containing the formula and look at the formula bar to confirm no stray spaces or hidden characters were typed. Then test the reference cell alone with =ISNUMBER(A1): TRUE means the date is valid and EOMONTH should work, FALSE means Excel is storing text and you need to re-enter the date.

Frequently Asked Questions

What does the second argument in EOMONTH do?

It sets how many months to add before finding the month end. Zero means the current month, -1 the previous month, -2 two months back, and positive numbers move forward.

Can I get the previous month end based on today's date?

Yes. Use =EOMONTH(TODAY(),-1). The value updates whenever the workbook recalculates, so it reflects the current date.

Does EOMONTH work with a date that is already a month-end?

Yes. It ignores the day of the supplied date and returns the last day of the month relative to it, so 3/31/2025 with -1 gives 2/28/2025.

Why does my result show as a five-digit number?

The cell is formatted as General. Excel stores dates as serial numbers and displays them only when a Date format is applied. Use Ctrl+1 and choose Date.

How do I get the first day of the previous month instead?

Use =EOMONTH(A1,-2)+1. This moves to the end of the month before last, then adds one day.

Is there a way to do this without EOMONTH?

Yes: =DATE(YEAR(A1),MONTH(A1),0) returns the last day of the previous month, because day zero of a month rolls back to the final day of the prior month.