Translate

29 December 2013

Count the Mondays next month

To count the number of Mondays in a month in an Excel cell, use the following formula:

=sumproduct(--(weekday(row(indirect((eomonth(today(),0)+1) & ":" & (eomonth(today(),1)))))=2))

In December 2013, this returns 4 because there are 4 Mondays in January 2014.  How do you alter the formula for any day of the week?  Change the 2 at the end of the formula to the number corresponding to the day of the week:
  • Sunday = 1
  • Monday = 2
  • Tuesday = 3
  • Wednesday = 4
  • Thursday = 5
  • Friday = 6
  • Saturday = 7
For example, changing the 2 to 6 in December 2013 would result in the number 5, as there are 5 Saturdays in January 2014.

As always, I welcome your comments.  Click on the Comment link below; it may say "No" or have a number in front of it.

No comments:

Post a Comment

Put comments here.