How to Get Total Days in Month in Excel

Sometimes you need to calculate the total number of days in a month to use in the further calculation.

It happens specifically when you work on templates and dashboards. So today, let me show a simple formula which can do this for you.

To calculate the number of days in a given month from a date, we need to use a formula based on EOMONTH and DAY.

Formula: Get Total Days in Month

=DAY(EOMONTH(A2,0))

get total number in month using day eomonth functions

How this formula works

As you see this formula is a combination of two of functions. We have EOMONTH which is cover within DAY.

First, when you refer a date and “0” in EOMONTH it returns the last date of that month. Here the date is on cell A2.

Second, DAY function returns the day from the last day returned by EOMONTH.

The day of month’s last day is always the total number of days in a month. From 31-Mar-2017, it returns 31 which is the totals number of days in the March month.

Dynamic Formula

Let’s you want to get total days in a month for the current month and you want this formula to return it automatically every time month changes.

Formula will be:

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

In this formula, instead of referring to a date we have referred TODAY in EOMONTH which returns the current date and then EOMONTH returns the last date from current date’s month.

In the end, DAY returns the day number and the get the total number of days for the current month.

Get Days in Month using Month Name

Let’s say you have entered a month’s name in a cell not a proper date and now you want to calculate total number of days from this month.

Formula will be:

=DAY(EOMONTH(DATEVALUE("01-"&A2&"-"&YEAR(TODAY())),0))

get total number in month using month name

This formula creates a first day’s date of the month you have mentioned and then EOMONTH returns the last date and DAY return the last day which is the total number of days in a month.

You can use month’s name both in short form and long form.

Related Functions

  1. Excel EOMONTH Function
  2. Excel TODAY Function
  3. Excel DAY Function
  4. Excel DATEVALUE Function
  5. Excel YEAR Function

Related Formulas

  1. End Date of a Month
  2. Get [Extract] a Month Name from a Date
  3. How to Convert Text to Date in Excel

Content Protection by DMCA.com
2018-08-31T11:14:41+00:00
>