Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Formula for 30 Days End of Month

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To get the date that is 30 days before the end of the month in Excel, use =EOMONTH(start_date,0)-30 for the end of the current month, or =EOMONTH(start_date,1)-30 for the end of the next month. The EOMONTH function returns the last day of a given month, and subtracting 30 gives you a date exactly 30 days prior. This is useful for billing cycles, payment deadlines, or any schedule that references "30 days before month-end."

What You'll Need

  • Excel (any recent version, including Excel for Microsoft 365, Excel 2019, 2016, or earlier – the functions used are standard).
  • A cell containing a date (the "start date") from which you want to calculate. This can be a date typed directly, a cell reference, or a formula that produces a date.
  • Basic familiarity with entering formulas in a cell.

Step-by-Step

  1. Identify your start date. Decide which month's end you want to work from. For example, if your start date is in cell A1 (say 15 March 2025), you can use that cell. If you want to use today's date, you can use TODAY() instead.
  2. Enter the EOMONTH formula. Click the cell where you want the result. Type =EOMONTH( then reference your start date. For instance, =EOMONTH(A1,0) returns the last day of the month of the date in A1. The second argument is the number of months to move forward (positive) or backward (negative). Zero means the same month.
  3. Subtract 30 days. After the EOMONTH part, add -30 to the formula. So the full formula becomes =EOMONTH(A1,0)-30. This gives you the date 30 days before the end of that month. For example, if A1 is 15 March 2025, EOMONTH returns 31 March 2025, and subtracting 30 gives 1 March 2025.
  4. Adjust for a different month. To get 30 days before the end of the next month, change the second argument to 1: =EOMONTH(A1,1)-30. For the previous month, use -1: =EOMONTH(A1,-1)-30.
  5. Format the result as a date. If the cell shows a number (like 45678), right-click the cell, choose Format Cells, select Date, and pick your preferred date format. Excel usually auto-formats, but if not, this step is essential.
  6. Copy the formula down or across. If you have a list of dates in column A, enter the formula in B1 and drag the fill handle down to apply to all rows. The cell references will adjust automatically (unless you use absolute references like $A$1).
  7. Use TODAY() for a dynamic result. If you want the result to always reflect the current month, replace the start date with TODAY(). For example, =EOMONTH(TODAY(),0)-30 always gives the date 30 days before the end of the current month.

Common Mistakes

  • Forgetting the second argument in EOMONTH. Writing =EOMONTH(A1) returns an error because EOMONTH requires two arguments. Always include the month offset (0, 1, -1, etc.).
  • Subtracting 30 from the start date instead of from the month-end. For example, =A1-30 gives 30 days before the start date, not 30 days before month-end. The whole point is to first find the month-end, then subtract.
  • Using DAY() or other functions unnecessarily. Some users try to construct the month-end with DATE(YEAR(A1),MONTH(A1)+1,0) – that works, but EOMONTH is simpler and less error-prone.
  • Not accounting for month lengths. February has 28 or 29 days, but EOMONTH handles this automatically. Do not try to manually adjust – trust the function.
  • Formatting the result as text. If the cell is pre-formatted as Text, the formula will show as text and not calculate. Change the cell format to General or Date before entering the formula.

Tips

  • Use EOMONTH for any month-end calculation. It's not just for 30 days – you can subtract any number of days: =EOMONTH(A1,0)-15 for 15 days before month-end.
  • Combine with other functions. For example, to get the first day of the month that is 30 days before month-end, use =EOMONTH(A1,0)-30 and then format as needed. Or use =EOMONTH(A1,0)-30+1 to get the day after that date.
  • Use cell references for flexibility. Instead of hardcoding 30, put the number of days in a separate cell (e.g., B1) and reference it: =EOMONTH(A1,0)-$B$1. Then you can change the number without editing the formula.
  • For a list of dates across months, use the ROW function. If you want a series of dates that are 30 days before the end of each month, you can use =EOMONTH($A$1,ROW(A1)-1)-30 and drag down. This increments the month offset.
  • Remember that EOMONTH returns a date serial number. If you see a large number, just format as date. Also, if you subtract 30 and get a date in the previous month (like 1 March from 31 March), that's correct – it's 30 days before month-end.

Troubleshooting

If the formula returns #VALUE! – This usually means the start date is not a valid date. Check that the cell contains a date (not text). If it's text, convert it using DATEVALUE or re-enter as a proper date.

If the result is a number like 45678 – This is a date serial number. Apply a date format via Format Cells > Date. If you want to force a date format, you can also use =TEXT(EOMONTH(A1,0)-30,"mm/dd/yyyy") but that returns text, so it's better to format the cell.

If the result is a date in the wrong month – Check the second argument in EOMONTH. Remember that 0 gives the end of the start date's month, 1 gives the next month, -1 gives the previous month. If you used 1 and expected the same month, change it to 0.

If the formula doesn't update when you change the start date – Ensure calculation is set to Automatic. Go to Formulas > Calculation Options > Automatic. If it's on Manual, Excel won't recalculate unless you press F9.

If you get a #NAME? error – This means Excel doesn't recognize the function name. Make sure you typed EOMONTH correctly and that you're not using a non-English version where the function might be named differently (e.g., in some locales it's MES.FIN). Check your Excel language.

Frequently Asked Questions

Can I use EOMONTH with a text date?

No, EOMONTH expects a date serial number or a reference to a cell containing a date. If you have a text date like "15/03/2025", use DATEVALUE to convert it first: =EOMONTH(DATEVALUE("15/03/2025"),0)-30.

What if I want 30 days before the end of the current month, but the month has 31 days?

That's fine – EOMONTH returns the actual last day of the month (31 for months with 31 days), and subtracting 30 gives you the 1st of that month. For a 30-day month, it gives the 0th day, which Excel interprets as the last day of the previous month. For example, April has 30 days, so EOMONTH(A1,0)-30 for April gives 31 March.

Does EOMONTH work with dates before 1900?

Excel's date system starts at 1 January 1900 (or 1904 on Mac, depending on settings). Dates before that are not supported. If you need to work with older dates, you'll need a different approach, like storing them as text.

Can I use this formula in Google Sheets?

Yes, EOMONTH works the same way in Google Sheets. The syntax is identical: =EOMONTH(A1,0)-30.

How do I get the date 30 days before the end of the month, but excluding weekends?

That's a different calculation. You'd need to use WORKDAY or WORKDAY.INTL to skip weekends. For example, to get the last weekday that is at least 30 days before month-end, you'd use something like =WORKDAY(EOMONTH(A1,0)-30, -1) to go back to the previous working day if the result falls on a weekend. But that's not a simple EOMONTH formula.

Why does my formula return a date in the past when I subtract 30?

That's expected if the month-end minus 30 falls in the previous month. For example, for March 31, minus 30 is March 1 – that's in the same month. For April 30, minus 30 is March 31 – that's in the previous month. It's correct because you're counting 30 days backward from the month-end.