We can use the EOMONTH and DAY functions to get the number of days in the month when we already have a single date. The steps below will walk through the process.
Figure 1: Result of using the DAY and EOMONTH functions
General Formula
=DAY(EOMONTH(date,0))
Formula
=DAY(EOMONTH(B5,0))
Setting up the Data
- We will set up data by inputting our Dates in Column B
- Our result, which is the Number of days in a month will be returned in Column C
Figure 2: Setting up the Data
Calculate the number of days using EOMONTH and DAY
- We will click on Cell C5
- We will insert the formula below into the cell
=DAY(EOMONTH(B5,0))
We will press the enter key
Figure 3: How to get the days of the month
- We will click on Cell C5 again
- We will double click on the fill handle tool which is the small plus sign you see at the bottom right of Cell C5. Select and drag down to copy the formula to other cells.
Figure 4: Result of using the DAY and EOMONTH functions
Explanation
=DAY(EOMONTH(B4,0))
Our DAY function is always equal to the number of days in the month. The EOMONTH function checks the date in Cell B4 and returns the date corresponding to the last day of the month we specified. Next, the DAY function works on the data derived by the EOMONTH and return with the total number of days for that month.
Instant Connection to an Expert through our Excelchat Service
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.
Leave a Comment