Excel Formula: Count Days of Month
In this tutorial, it provides formulas to count the total days of a specific month or the current month.
If you want to follow along with this tutorial, please download the example spreadsheet.
Generic formula:
DAY(EOMONTH(date,0)) |
Syntaxt and Arguments
Date: the date that you want to count days of month. The date argument can be a number or date (since the date is stored as number in Excel). |
Return Value
The formula returns to a numeric value.
Error
If the date argument is a text value, the formula returns the #VALUE! error.
How this formula works
To count the total days of the specific month in each cell of B3:B6, please use below formula in cell C3:
=DAY(EOMONTH(B3,0)) |
Press Enter key and then drag autofill handle down to cell C6.
Explanation
EMONTH function: gets the last day of the month in future or past. EOMONTH(B3,0) gets the last day of month in cell B3, 2/29/2020.
DAY function: gets the days as number from a date.
=DAY(EOMONTH(B3,0))
=DAY(“2/29/2020”)
=29
Remark
1) If you want to automatic return the total days of the current month when the date changes, you can change the generic formula to this:
DAY(EOMONTH(TODAY(),0)) |
TODAY function is used to get the current date of today.
2) If you want to get the days from a month name, you can change the generic formula to this:
DAY(EOMONTH(DATEVALUE("01-"&date&"-"&YEAR(TODAY())),0)) |
Example: supposing to get the days from the month name in cell B9, please use the formula as this:
=DAY(EOMONTH(DATEVALUE("01-"&B9&"-"&YEAR(TODAY())),0))
Press Enter key to get the result.
YEAR function: returns the year based on the given date.
DATEVALUE function: converts a date stored as text format to a valid date.
=DAY(EOMONTH(DATEVALUE("01-"&B9&"-"&YEAR(TODAY())),0))
=DAY(EOMONTH(DATEVALUE("01-"&B9&"-"&2020),0))
=DAY(EOMOTH(“1/1/2020”,0))
=DAY("1/31/2020")
=31
Relative Formulas
- Check if a date is workday
This tutorial provides a formula to to check a date if is a workday. - Check two dates are in the same year month
To check if two dates in the same year month, you can use the formula in this tutorial. - Create date range from two dates
This tutorial provides a formula with TEXT function to create a date range based on two dates in text format in Excel. - Create weekly date range
In this tutorial, it provides a formula to quickly get the weekly date range in Excel.
Relative Functions
- Excel WEEKNUM Function
Returns the week number of the given date in a year - Excel WORKDAY Function
Adds workdays to the given start date and returns a workday - Excel MONTH Function
The MONTH is used to get the month as integer number (1 to 12) from date - Excel DAY Function
DAY function gets the day as a number (1 to 31) from a date - Excel NOW Function
Get the current time and date
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Full-Featured 30-Day Free Trial.

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
