ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Dates
  3. How Many Days in a Month: Excel Formula

How Many Days in a Month: Excel Formula

By ExcelReady Team·Updated November 2, 2026·6 min read

The short answer

Use =DAY(EOMONTH(A2,0)), where A2 is any date in the month. EOMONTH(A2,0) returns the last day of that month, and DAY takes its day number, which is the number of days in the month. It handles leap years automatically: any date in February 2024 returns 29. It works in every current version of Excel.

Key takeaways

  • =DAY(EOMONTH(A2,0)) returns 28, 29, 30 or 31 for the month of the date in A2.
  • EOMONTH(date,0) gives the last day of the same month; DAY pulls out its day number.
  • With a year and month number, use =DAY(DATE(year,month+1,0)). Day 0 means the last day of the month before.
  • Days left in the month: =EOMONTH(A2,0)-A2. Working days: =NETWORKDAYS(EOMONTH(A2,-1)+1,EOMONTH(A2,0)).
  • If the answer shows as a date, change the cell's number format to General.
On this page+
  1. The days in month formula
  2. How to get the days in the current month
  3. Days in a month from a month and year number
  4. How many days are left in the month?
  5. How many working days are in the month?
  6. Example: split a monthly cost by days
  7. How to list the days in every month of a year
  8. Common mistakes
  9. Practise it

To count the days in a month in Excel, use =DAY(EOMONTH(A2,0)), where A2 is any date in that month. It returns 28, 29, 30 or 31 and handles leap years for you. This guide explains how the formula works, then shows the variations people need for budgets, rotas and reports: the current month, a month and year typed as numbers, days left in the month and working days.

All the examples use these dates in column A:

AB
1DateDays in month
210 Feb 202429
33 Feb 202528
422 Apr 202530
51 Jul 202531
631 Dec 202531

The days in month formula#

The formula has two parts. In B2:

Excel formula
=DAY(EOMONTH(A2,0))
  1. EOMONTH(A2,0) returns the end of the month: the last day of the month that A2 is in. For 10 Feb 2024 that is 29 Feb 2024. The 0 means "this month". A 1 would mean next month and a -1 last month.
  2. DAY(...) returns the day number of that date, from 1 to 31. The last day of a month is always the same as the number of days in it, so the result is 29.

Fill the formula down (Windows: Ctrl+D; Mac: Cmd+D) to get 28, 30, 31 and 31 for the other rows. Note that 2024 is a leap year and 2025 is not, and the formula gets both right without any extra check. The EOMONTH function guide lists its arguments.

How to get the days in the current month#

Replace the cell with TODAY to always get the current month:

Excel formula
=DAY(EOMONTH(TODAY(),0))

Because TODAY changes every day, the result updates itself when a new month begins. This is useful in dashboards that show "day 12 of 30" or a daily target.

Days in a month from a month and year number#

Sometimes you don't have a date, only a year in B2 (2025) and a month number in C2 (2). Build the date with DATE instead:

Excel formula
=DAY(DATE(B2,C2+1,0))

This uses a handy DATE trick: day 0 of a month means the last day of the month before. So DATE(2025,3,0) is 28 Feb 2025, and DAY returns 28. It works for December too: DATE(2025,13,0) rolls over to 31 Dec 2025.

You could also write =DAY(EOMONTH(DATE(B2,C2,1),0)). Both give the same answer, so use whichever you find easier to read.

If the month is text, such as "Feb 2025", turn it into a date first with DATEVALUE: =DAY(EOMONTH(DATEVALUE("1 "&A2),0)). How DATEVALUE reads text depends on your computer's date settings, so test it on your own data. To go the other way and show a month name, see how to get the month name from a date.

How many days are left in the month?#

Subtract the date from the last day of its month:

Excel formula
=EOMONTH(A2,0)-A2

For 10 Feb 2024, the result is 29 − 10 = 19 days left after today. Add 1 if you want to count the date itself: =EOMONTH(A2,0)-A2+1 gives 20. If the answer appears as a date, change the format to General.

The opposite question, "how many days have passed?", is simply =DAY(A2), which gives 10. Together they power month-to-date reports, covered in the guide to month-to-date totals.

How many working days are in the month?#

For working days (Monday to Friday), give NETWORKDAYS the first and last day of the month:

Excel formula
=NETWORKDAYS(EOMONTH(A2,-1)+1,EOMONTH(A2,0))

EOMONTH(A2,-1)+1 is the day after the end of last month, which is the 1st of this month. For February 2024, the result is 21 working days. Add a list of public holidays as a third argument to leave those out too. The first and last day of the month guide explains these month-boundary formulas in more detail.

Example: split a monthly cost by days#

Days in the month is often a step in a bigger formula. Say a tenant moves in on 19 Apr 2025 (A2) and the monthly rent is 1,200 (C2). They pay for 19 to 30 April, which is 12 days:

Excel formula
=C2/DAY(EOMONTH(A2,0))*(EOMONTH(A2,0)-A2+1)

That is 1,200 / 30 × 12 = 480. The same pattern spreads a monthly budget into a daily figure, or works out a part-month salary. To shift dates by whole months instead, see how to add days, months and years. To total values for each month, see how to count by month.

How to list the days in every month of a year#

In Excel 2021, Excel 2024 or Microsoft 365, SEQUENCE can build all twelve months at once:

Excel formula
=DAY(EOMONTH(DATE(2025,SEQUENCE(12),1),0))

SEQUENCE(12) makes the numbers 1 to 12, so DATE builds the 1st of each month, and the formula spills 12 results down the column: 31, 28, 31, 30 and so on. Swap 2025 for 2024 and the second value becomes 29. That makes it a quick leap year check too: =DAY(EOMONTH(DATE(B2,2,1),0))=29 returns TRUE when the year in B2 is a leap year.

Common mistakes#

  • The answer looks like a date. If B2 had a date format, 29 shows as 29/01/1900. Change the format to General (Windows: Ctrl+Shift+; Mac: Ctrl+Shift+).
  • The date is text. A date typed as text, often aligned left, makes EOMONTH return #VALUE!. Convert it with DATEVALUE or re-enter it.
  • Forgetting the 0. EOMONTH needs two arguments. =EOMONTH(A2) is an error.
  • Typing 30 for every month. Hard-coded numbers break in February and 31-day months. Let the formula work it out.

Practise it#

Practise EDATE, EOMONTH and WEEKDAY in a live spreadsheet: you type each date formula and it checks your answer instantly. Start with the February 2024 exercise on this page, then fill the formula down to see 28, 30 and 31.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

How many days are in the month of the date in A2? In B2, use DAY and EOMONTH together.

fx
ABCD
1
Date
Days in month
2
45332
3
45691
4
45769
5
45839
6
46022
7
8
9

Tip: EOMONTH(A2,0) gives the last day of February 2024. Wrap it in DAY to get its day number. The answer is 29.

Practise this in a lesson

LessonRenewals and month-ends: EDATE, EOMONTH, WEEKDAYShift dates by whole months with EDATE, jump to month-end with EOMONTH, and find the day of the week with WEEKDAY.Function guideEOMONTHFind the last day of any month with Excel's EOMONTH for due dates, month totals and days in a month. Examples, pitfalls and a live exercise.

Frequently asked questions

What is the formula for the number of days in a month in Excel?

+

=DAY(EOMONTH(A2,0)), where A2 holds any date in the month. EOMONTH finds the last day of the month and DAY returns its day number, such as 30 or 31.

How do I get the number of days in the current month?

+

Use =DAY(EOMONTH(TODAY(),0)). TODAY returns the current date, so the answer updates by itself when a new month starts.

Does the days in month formula handle leap years?

+

Yes. EOMONTH knows the calendar, so any date in February 2024 returns 29 and any date in February 2025 returns 28. You don't need a separate leap year check.

How do I get days in a month from a month number and a year?

+

Use =DAY(DATE(B2,C2+1,0)) with the year in B2 and the month number in C2. Day 0 of the next month is the last day of the month you want.

Why does my days in month formula show a date?

+

The cell has a date format, so Excel shows the number 29 as a date in January 1900. Change the number format to General or Number and you will see 29.

Sources

  • EOMONTH function - Microsoft Support
  • DATE function - Microsoft Support
  • NETWORKDAYS function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. The days in month formula
  2. How to get the days in the current month
  3. Days in a month from a month and year number
  4. How many days are left in the month?
  5. How many working days are in the month?
  6. Example: split a monthly cost by days
  7. How to list the days in every month of a year
  8. Common mistakes
  9. Practise it

Keep reading

Dates· 6 min read

Add Days, Months or Years to a Date in Excel

To add days to a date in Excel, just add the number: =A2+30. For working days, use =WORKDAY(A2,10). To add months, use =EDATE(A2,3), which handles months of different lengths. To add years, use =EDATE(A2,12*n), for example =EDATE(A2,24) for two years. Use negative numbers to go back in time.

Dates· 6 min read

How to Count Dates by Month in Excel

To count dates by month in Excel, use COUNTIFS with a date range: put the first day of the month in E2 and use =COUNTIFS(B2:B100,">="&E2,B2:B100,"<="&EOMONTH(E2,0)). EOMONTH(E2,0) returns the last day of that month. Fill the formula down next to a list of month start dates to build a monthly summary. Add more pairs for extra conditions.

Dates· 7 min read

First and Last Day of the Month in Excel

For the first day of the month in Excel, use =EOMONTH(A2,-1)+1: the last day of the previous month plus one day. You can also write =DATE(YEAR(A2),MONTH(A2),1). For the last day of the month, use =EOMONTH(A2,0). Change the month number in EOMONTH to move to next month (1) or last month (-1).

More on dates

  • Days Until a Deadline in Excel (Countdowns)
  • Due Date Formulas in Excel: Days, Workdays, Months
  • EDATE and EOMONTH: Add Months and Find Month-End
  • Calculate an End Date From a Start Date and Duration
  • Expiry Dates in Excel: Days Left and Status Flags
  • Fiscal Month and Period Number From a Date in Excel
All dates articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free