fxExcelReps

← How-to guides

How to Get the Last Day of the Month in Excel

=EOMONTH(A2, 0) returns the last day of the month of the date in A2; use 1 for next month and -1 for the previous one. Format the cell as a date, because EOMONTH returns the date's serial number.

{"cells": {"A1": "Question", "A2": "Last day of the month", "A3": "First day of the month", "A4": "Last day of next month", "A5": "Days in the month", "A9": "Date", "B1": "Answer", "B2": "=EOMONTH(B9,0)", "B3": "=EOMONTH(B9,-1)+1", "B4": "=EOMONTH(B9,1)", "B5": "=DAY(EOMONTH(B9,0))", "B9": 46071}, "focus": "B2", "formats": {"B2:B4": {"fmt": "date"}, "B9": {"fmt": "date"}}, "note": "Change the date in B9, for example to a February date."}

EOMONTH

The second argument moves by whole months.

=EOMONTH(A2, 0)The last day of this month.
=EOMONTH(A2, -1)The last day of the previous month, a common reporting date.
=EOMONTH(TODAY(), 0)The last day of the current month.

First day and number of days

The day after the previous month-end is always the 1st.

=EOMONTH(A2, -1)+1The first day of the month.
=DAY(EOMONTH(A2, 0))28, 29, 30 or 31.

Last working day

Step back from the first day of the next month.

=WORKDAY(EOMONTH(A2, 0)+1, -1)The last Monday-to-Friday day of the month.

Common mistakes

A number like 46081 appears
Format the cell as Short Date.
Same day next month, not month-end
Use EDATE: =EDATE(A2, 1) keeps the day of the month.

Frequently asked questions

What's the difference between EOMONTH and EDATE?

EOMONTH always returns a month-end; EDATE returns the same day, months later.

Can I use EOMONTH in SUMIFS?

Yes, it's the easiest way to total a month. See sum by month.

Does it handle leap years?

Yes. February 2028 ends on the 29th.

Practise it

EOMONTHDATENETWORKDAYS

Think you know this?

15 formula tasks, no hints, with a leaderboard. Absolute, relative and mixed references included.

Take the Pro Challenge →

More how-to guides

How to Calculate Percentage Change in Excel

Calculate the percentage increase or decrease between two numbers in Excel with (new - old) / old, and format the result as a percent.

How to Calculate the Percentage of a Total in Excel

Calculate each row's share of a total in Excel with an absolute reference, so the formula works when copied down. Live example.

How to Count Unique Values in Excel

Count distinct values in an Excel column with COUNTA and UNIQUE, or SUMPRODUCT and COUNTIF in older versions, with a condition too.

How to Round to the Nearest 5, 10 or 100 in Excel

Round numbers to the nearest 0.05, 5, 10, 100 or 1000 in Excel with ROUND, MROUND, CEILING and FLOOR. Live examples to try.