# Number of Days in a Month – Formulas in Excel and Google Sheets

Download the example workbook

In this Article

*This tutorial will teach you how to calculate the number of days in a month using Excel or Google Sheets.*

## Calculate Number of Days in a Month

### Last Day of Month

The first step to calculating the number of days in a month is to calculate the last day of the month. We can easily do this with the EOMONTH Function:

1 |
=EOMONTH(B3,C3) |

We enter the date into the EOMONTH Function and “0” to calculate the last day of the current month (we would use -1 to calculate the last day of the previous month).

### Calculate Day

Next we use the DAY Function to extract the day number of the last day of the month:

1 |
=DAY(EOMONTH(B3,0)) |

This will tell us the number of days in the month.

## Number of Days in Current Month

We can utilize the TODAY Function to calculate the last day of the current month:

1 |
=DAY(EOMONTH(TODAY(),0)) |

## Number of Days in Previous Month

As mentioned above we can set the second argument of the EOMONTH Function to -1 to calculate the last day of the previous month:

1 |
=DAY(EOMONTH(TODAY(),-1)) |

## Days in Month – Google Sheets

There formulas work exactly the same in Google Sheets as in Excel: