Calculate Elapsed Days by Month in Excel Through Today or an End Date
Question details
Calculate the number of elapsed days in a selected month, ending at today if no end date is entered or at the specified end date otherwise.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains a start date, an optional end date, and a month for which elapsed days should be calculated.
- Observed behavior
- The desired result counts only the days that fall within the selected month and the applicable date range.
Enter a start date in A2, an optional end date in B2, and any date in the month to calculate in C2. Use valid Excel dates without time values, and leave B2 empty when the calculation should stop at today.
Use EOMONTH to calculate days within each month
Use this formula to count calendar days in the selected month, including both the start and end dates.
The formula limits the calculation to the selected month. A blank end date uses TODAY(); an entered end date is used even if it is in the future.
In Excel, enter the start date in A2, the optional end date in B2, and a date in the target month in C2.
Select D2 and enter =IF(OR(A2="",C2=""),"",MAX(0,MIN(IF(B2="",TODAY(),B2),EOMONTH(C2,0))-MAX(A2,EOMONTH(C2,-1)+1)+1)).
Select D2 and choose Home > Number > General or Number. Drag the fill handle down to calculate additional rows.
Leave B2 blank to check the result through today, then enter an end date in B2 and confirm that the result stops at that date or the month end.

Calculate Monthly Elapsed Days in WPS Spreadsheet
Use the same date formula in WPS Spreadsheet to count days within a month, stopping at today or an entered end date.
- 1. Open your workbook: Open WPS Spreadsheet and choose Open to select your Excel workbook.
- 2. Enter the dates: Enter the start date in A2, an optional end date in B2, and a date in the target month in C2.
- 3. Calculate the days: Select D2 and enter =IF(OR(A2="",C2=""),"",MAX(0,MIN(IF(B2="",TODAY(),B2),EOMONTH(C2,0))-MAX(A2,EOMONTH(C2,-1)+1)+1)).
- 4. Format and save: Set D2 to General or Number format, then use File > Save As to save the workbook as an XLSX file.

Frequently Asked Questions
What happens when the end-date cell is blank?
The formula uses TODAY() as the end date. The result updates when Excel recalculates the workbook.
Does the formula count both the start and end dates?
Yes. The +1 in the formula includes both dates when they fall within the selected month.
What happens if the entered end date is in the future?
The formula uses the entered end date, not today, and limits the count to the end of the month in C2.
Why does the formula return zero for a month?
The date range may not overlap the month in C2. Check the start date in A2, the end date in B2, and the target month in C2.




