EOMONTH in Excel: End of Month Formula Guide
In this article
The EOMONTH function in Excel returns the last day of a month, either in the current month or a specified number of months before or after. It's the quickest way to calculate month-end dates for due dates, reporting periods, or financial close dates. The syntax is simple: =EOMONTH(start_date, months). For example, =EOMONTH(A1, 0) returns the last day of the month for the date in A1, while =EOMONTH(A1, 1) returns the last day of the next month.
What You'll Need
- Microsoft Excel (any recent version, including Excel 365, Excel 2021, or older versions—EOMONTH has been available since Excel 2007)
- A date value in a cell, or a date entered directly into the formula
- Basic familiarity with entering formulas in Excel
Step-by-Step
- Open your Excel worksheet and locate the cell that contains the date you want to work with. If you don't have a date yet, enter one in any cell, like
01/15/2024. - Select the cell where you want the end-of-month date to appear. This is typically a separate cell from your start date.
- Type the formula: Begin with an equals sign, then type
EOMONTH(. Excel will show a tooltip as you type. - Enter the first argument: Click on the cell that contains your start date, or type the date directly in quotes (e.g.,
"2024-01-15"). If you type a date directly, ensure it's in a format Excel recognizes. - Add a comma, then enter the number of months. Use
0for the same month,1for the next month,-1for the previous month, and so on. You can also reference a cell that contains the number of months. - Close the parentheses and press Enter. The cell will display the last day of the specified month.
- Format the result as a date: If you see a number (like 45292) instead of a date, the cell is formatted as a number. Right-click the cell, choose Format Cells, select Date, and pick the format you prefer.
Example: If cell A1 contains 2024-02-10, then =EOMONTH(A1, 0) returns 2024-02-29 (because 2024 is a leap year). =EOMONTH(A1, 1) returns 2024-03-31.
Common Mistakes
- Forgetting the second argument: EOMONTH requires both arguments. If you omit the comma and months, you'll get a #VALUE! error.
- Using text that looks like a date: If your start_date is text, Excel may not recognize it. Use DATE(2024,1,15) or a cell reference to ensure it's a true date.
- Misunderstanding the months argument: A positive number moves forward, negative moves backward. Zero gives the current month's end.
- Not formatting as a date: If the result appears as a serial number, it's because the cell format is General or Number. Always apply a date format.
- Using EOMONTH for a date in the past that is already the last day: EOMONTH will still return the last day of that month, not the next month. For example, EOMONTH(DATE(2024,1,31), 0) returns 2024-01-31, not 2024-02-29.
Tips
- Combine with other functions: Use EOMONTH with DAY, WEEKDAY, or SUMIFS for dynamic reporting. For instance, to get the first day of the month, use
=EOMONTH(A1, -1) + 1. - Use for aging reports: Calculate the end of the current month and compare with invoice dates to determine overdue status.
- Leverage for financial close: Automate month-end close dates by referencing a single date cell and using EOMONTH with different month offsets.
- Create a dynamic date range: Use EOMONTH in conjunction with TODAY() to always get the current month's end:
=EOMONTH(TODAY(), 0). - Handle leap years automatically: EOMONTH correctly returns 29 for February in leap years, so you don't need to adjust manually.
Troubleshooting
If you get a #VALUE! error: The start_date is not a valid date. Check that the cell contains an actual date, not text. Use DATE() to create a date if needed.
If you get a #NUM! error: The months argument is out of range (usually too large). Excel supports a wide range, but extremely large numbers (beyond 2,000,000) can cause issues. Keep months within a reasonable range.
If the result is a number like 45292: This is the serial number for the date. Change the cell format to Date (Home > Number Format > Date).
If the formula doesn't recalculate: Press F9 to recalculate manually, or ensure calculation is set to Automatic (Formulas > Calculation Options).
If you see #NAME?: This usually means the function name is misspelled. Check that you typed EOMONTH correctly.
Frequently Asked Questions
Can EOMONTH return the last day of the current month?
Yes, use =EOMONTH(TODAY(), 0) to get the last day of the current month based on your system's date.
How do I get the last day of the previous month?
Use =EOMONTH(A1, -1) where A1 is any date in the current month, or =EOMONTH(TODAY(), -1) for the previous month relative to today.
Does EOMONTH work with dates in different formats?
Yes, as long as Excel recognizes the value as a date. If you have text like "Jan 15, 2024", you may need to convert it using DATEVALUE() first.
Can I use EOMONTH to calculate the number of days in a month?
Yes, combine it with DAY: =DAY(EOMONTH(A1, 0)) returns the number of days in the month of the date in A1.
What is the difference between EOMONTH and EDATE?
EDATE returns the same day in a different month (e.g., EDATE(A1,1) gives the same day next month), while EOMONTH always gives the last day of the month.
Why does EOMONTH return a date in the past when I use a negative month?
That's expected. A negative months argument moves backward in time. For example, EOMONTH(DATE(2024,3,15), -1) returns February 29, 2024.