Custom Function for Days in the Month

Excel’s EOMONTH function is great. Here is a tweak using a custom function to calculate the number of days in a month.

Custom functions are new – below is a link to an earlier blog post explaining and demonstrating a custom function.

Days in the month

How many days in the month? This is usually calculated with a formula like.


Let’s simplify it to this.


The LAMBDA function that you can save as a custom function is this.


This works on the current month of the date used. Any date will return the number of days in the month.

The New Name dialog creating this Custom Function is shown below.

The formulas used are in the image below. The formulas are in column B but are shown in column C.

In the next blog post and I will cover returning the last weekday date of the month.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.