# How to get the last day of the month in Excel

Use =EOMONTH(date, 0). The 0 means this month; 1 is next month and -1 is last month.

**Excel:** `=EOMONTH(B2,0)` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C |
| --- | --- | --- |
| Invoice | Invoice date | Due (end of month) |
| INV-401 | 2026-01-08 |  |
| INV-402 | 2026-02-17 |  |
| INV-403 | 2028-02-03 |  |
| INV-404 | 2026-04-30 |  |
| INV-405 | 2026-11-21 |  |

Formula in C2, filled to C6: `=EOMONTH(B2,0)`

Result: 1/31/2026; 2/28/2026; 2/29/2028; 4/30/2026; 11/30/2026

## How it works

EOMONTH ("end of month") returns the last day of the month a given number of months away. With 0 it stays in the same month, and it knows about leap years: February 2028 ends on the 29th.

## Other ways

- `=DATE(YEAR(B2),MONTH(B2)+1,0)`: Day 0 of next month is the last day of this month. Works in any version.
- `=EOMONTH(B2,-1)+1`: The first day of the month instead. (First day of the month.)

## Common mistakes

- EOMONTH returns a serial number; format the cell as a date.
- For "end of next month" terms, use 1 instead of 0.

## Questions

**How do I get the first day of the month?**

`=EOMONTH(B2,-1)+1`, or `=DATE(YEAR(B2),MONTH(B2),1)`.

**How many days are in the month of a date?**

`=DAY(EOMONTH(B2,0))`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-29.

Source: https://spreadsheetpractice.com/formulas/last-day-of-the-month
