Note: The other languages of the website are Google-translated. Back to English
Log in  \/ 
x
or
x
Register  \/ 
x

or

Excel Formula: Count Days of Month

doc convert date to julia 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 convert date to julia 1

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 convert date to julia 1
doc convert date to julia 1

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 convert date to julia 1

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

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

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.
Screen Shot of Excel (with Office Tab installed)
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.