Spreadsheet Practice

How to get the last day of the month in Excel

Formula (Excel and Google Sheets)

=EOMONTH(B2,0)

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

Result on the example
one result per row in C2, filled down to C6
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in C2, filled down to C6. Change any input and the result updates, or edit the formula to experiment.

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.

=EOMONTH(B2,0)

Result1/31/2026 (46053)

  1. B21/8/2026

    The value in B2.

  2. EOMONTH(B2,0)1/31/2026 (46053)

    EOMONTH: Last day of the month, months away.

    • start_dateB21/8/2026
    • months0

In Google Sheets

The same formula works in Google Sheets: =EOMONTH(B2,0). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=DATE(YEAR(B2),MONTH(B2)+1,0)1/31/2026, 2/28/2026, 2/29/2028…Day 0 of next month is the last day of this month. Works in any version.
=EOMONTH(B2,-1)+11/1/2026, 2/1/2026, 2/1/2028…Different resultThe 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.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Get the last day of the month

In C2, return the last day of the invoice's month, and fill down to C6.

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)).

Checked by running on 2026-10-29: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.