← All how-to recipes

How to get the last day of the previous month

✓ Verified in LibreOffice 25.8.7.3

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

The formula

AppFormulaNotes
Excel=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. Every formula here is confirmed by actually executing it.