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 – Using the CELL function

Here’s a small selection of useful functions, including CELL, MID and FIND. Typing “=CELL(“ in Excel will drop this menu down. Most are self-explanatory, but there are some uses for CELL with filename that are “different”. For example,... Continue →