Skip to main content

Excel Formula: Count Days of Month

Author Sun Last modified

doc-count-days-of-month 1

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.
doc-sample

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.
doc-count-days-of-month 2
doc-count-days-of-month 3

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.
doc-count-days-of-month 4

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

Relative Functions


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...


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, Edge and Firefox.