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: Dynamic Summing To-Date

Here is our example spreadsheet: The SUM formula in cell B15 is shown. It uses MONTH(NOW()), but could just as easily use a Named Formula: =SUM(OFFSET(Totals2009,0,0,ThisMonth,1)) Here’s the formula in Name Manager: How it works OFFSET’s... Continue →