Excel Formula to get Number of Days in a Month

It seems Excel still can’t tell me the days in a particular month.

The following formula works, though:


Obviously, A1 has to have a date in it.

Works like a charm:

 Update, much, much later: Looks like LibreOffice has a DAYSINMONTH function.

20 thoughts on “Excel Formula to get Number of Days in a Month”

  1. Hey Linto,

    There seems to be no "get previous month" function in OpenOffice (and I don't have MS Office installed right now), so I came up with this formula which seems to work:


    It gives you the first day of the previous month of a date in field a1. To get the length of that previous month, just use the same formulas from this post on the date you have thus obtained.

  2. I want to get result by giving name of month like "January", "February" etc. instead of given date in cell B3. Is it possible? if yes, anybody please help me soon. Thanks

  3. Awesome, one click answer, thanks.
    Now, can we calculate just the weekdays in a month with a similar method?

  4. No need or such a "long" formula.

    In B2 type: =DAY(EOMONTH(B3,0))

    Michael Avidan
    “Microsoft®” MVP – Excel

Leave a Reply

Your email address will not be published.

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

%d bloggers like this: