To find the last day of any given month in Excel, use the EOMONTH function. It returns the serial number representing the final date of the month, relative to a start date. This is essential for financial reports, payroll cycles, or any time-based tracking that aligns to month-end. No add-ins or external tools are required—EOMONTH is built into Excel 2007 and later versions.
What You'll Need
- A version of Excel from 2007 or later (including Microsoft 365, Excel 2019, 2016, etc.)
- A cell containing a date you want to base the calculation on (e.g., any day within the target month)
- Basic familiarity with entering formulas in Excel cells
Step-by-Step
- Open your Excel workbook and identify the cell that contains the reference date. For example, if you want the end of the month for January 2024, enter
1/15/2024in cell A2. - Click on the cell where you want the end-of-month date to appear—for example, cell B2.
- Type the formula:
=EOMONTH(A2,0). The first argument (A2) is the reference date. The second argument (0) means you want the last day of the same month as the reference date. - Press Enter. Excel will display the date as a serial number (e.g., 45317) by default.
- Right-click the cell with the result (B2), then select Format Cells.
- In the Format Cells window, under the Number tab, choose Date from the Category list.
- Select a date format that displays the full date, such as
3/14/2024or14-Mar-2024, then click OK. - To get the end of the next month, change the formula to
=EOMONTH(A2,1). For the end of two months prior, use=EOMONTH(A2,-2). - To apply this to a column of dates, click the cell with your formula (B2), then drag the fill handle (small square at the bottom-right corner of the cell) down to copy the formula to other rows.
Common Mistakes
- Forgetting to format the result as a date, causing Excel to show a large number instead of a readable date
- Using a text string instead of a proper date in the reference cell—Excel will return a #VALUE! error
- Typing
EOMONTHasEndOfMonthor another variation—Excel only recognizes the exact function name - Leaving the second argument blank; if omitted, Excel may interpret it as an error or default to 0, but it’s better to always include it explicitly
- Using a date in a different regional format (e.g., DD/MM/YYYY vs MM/DD/YYYY) without ensuring Excel interprets it correctly—this can cause miscalculations
Tips
- Combine EOMONTH with other functions like
TEXTto format the output as text—for example,=TEXT(EOMONTH(A2,0),"mmmm yyyy")returns "January 2024" - Use EOMONTH with
TODAY()to always get the end of the current month:=EOMONTH(TODAY(),0) - For payroll or billing cycles, use
=EOMONTH(A2,-1)+1to get the first day of the next month - If your reference date might be blank, wrap it in an IF statement:
=IF(A2="","",EOMONTH(A2,0))to avoid errors - Test your formula with known dates—e.g., if A2 is 2/29/2024, EOMONTH should return 2/29/2024 (leap year), not 3/1/2024
Troubleshooting
If your formula is not working, follow these checks in order:
- Verify the reference cell contains an actual date. Type
=ISNUMBER(A2)into a blank cell. If it returns FALSE, the cell contains text or is empty. Fix by re-entering the date as1/15/2024or usingDATE(2024,1,15) - Check for extra spaces or non-breaking characters in the reference cell. Use
=TRIM(A2)to clean it, or copy the value and paste it as values only. - Ensure your Excel version supports EOMONTH. If you’re using Excel 2003 or earlier, this function is not available. Upgrade or use the workaround:
=DATE(YEAR(A2),MONTH(A2)+1,0)—this subtracts one day from the first day of the next month. - If you see #NAME?, Excel doesn’t recognize the function. Confirm spelling. If you’re using a non-English version of Excel, the function may be localized (e.g.,
FINMENSin German). Use the English name regardless of language settings. - If the result shows as a number, format the cell as Date (as described in Step 5–7 above). This is the most common fix.
- If you’re working with a date imported from a CSV or web source, use Data > Text to Columns > Delimited > Finish to force Excel to recognize it as a date.
Frequently Asked Questions
Can EOMONTH work with time values?
Yes, but it ignores the time component. If A2 contains 1/15/2024 3:30 PM, EOMONTH will still return 1/31/2024 (no time). If you need to preserve time, use =EOMONTH(A2,0)+TIME(HOUR(A2),MINUTE(A2),SECOND(A2)).
What if I need the end of the month for a date in another time zone?
Excel does not handle time zones natively. EOMONTH uses the system clock’s date, which reflects your local time. For international reporting, store dates as UTC and adjust afterward using formulas, or use external tools.
Can I use EOMONTH to find the last weekday of a month?
No, EOMONTH returns the calendar end date, even if it’s a weekend. To find the last business day, combine it with WORKDAY: =WORKDAY(EOMONTH(A2,0)+1,-1). This moves backward one day from the first day of the next month.
Why does EOMONTH return a number instead of a date?
Excel stores dates as serial numbers (days since January 1, 1900). The number 45317 equals March 15, 2024. You must format the cell as Date to display it correctly.
Does EOMONTH work with dates from other countries?
Yes, as long as Excel interprets the input as a valid date. For example, 15/1/2024 (DD/MM/YYYY) works if your system uses European date formats. If unsure, use DATE(year,month,day) to avoid ambiguity.
Is there a limit to how far back or forward EOMONTH can calculate?
Excel’s date system supports dates from January 1, 1900, to December 31, 9999. EOMONTH works across this entire range. However, dates before 1900 are not supported and will return an error.