Excel: Days in Month

This is the simplest way I know of to find calendar days in a month, using the “zeroth” day of the following month. Formula makes a DAY from supplied inputs:

1) year 2) month + 1 3) zero.

The formula looks like this:

=DAY(DATE(YEAR, MONTH+1,0))

Pretty simple! Another small trick is to use ROW() to get a simple incrementing counter. ROW() returns the current row, and you can add or subtract a base number from it to use as your counter for 1 to 12 (for the month in this example).

The months begin on Row 3, but only 1 is subtracted because we need to arrive at month incremented by one. So, in A3 (Jan), we are finding days in month using day 0 of February.

=DAY(DATE($B$2,ROW()-1,0))

Days in Month

Screen Shot 2017-11-01 at 11.02.45 AM.png

Let’s look at 2016 (a Leap Year) to check that February always works…

Screen Shot 2017-11-01 at 11.03.09 AM.png

Bio: This article was written by Jasper Cook, Excel guru and trombonist of note. Call or email us if KRS can assist you with your Excel: enquiries@krs.co.dev

 
0
Kudos
 
0
Kudos

Now read this

Excel Tips – A Matching Truth

A user recently asked: “I have scheduled fixed days throughout the year for a certain task. Some weeks, it isn’t needed at all, and some weeks contain more than one day for this task. It’s also on different days of the week. Instead of... Continue →