← All how-to recipes

How to get the last day of the previous month

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Find the closing date of last month — report cutoffs, statement dates, accruals.

The formula

AppFormulaNotes
Excel (desktop)=EOMONTH(TODAY(),-1)EOMONTH(date,0) = end of the date's own month; -1 steps back one month.
Google Sheets=EOMONTH(TODAY(),-1)Identical.
LibreOffice Calc=EOMONTH(TODAY(),-1)Identical.

How it works

EOMONTH jumps to the end of a month a given number of months away: from July 22, offset −1 lands on June 30 — month lengths and leap years handled for you. The companion trick: the FIRST day of the current month is =EOMONTH(TODAY(),-1)+1, and the last day of the current month is EOMONTH(TODAY(),0). Format the result cell as a date.

Verified, not just documented

We ran =TEXT(EOMONTH(DATE(2026,7,22),-1),"YYYY-MM-DD") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 2026-06-30 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 2026-06-30 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

EOMONTH · TODAY — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons