Calculation Issues

Calculate Elapsed Days by Month in Excel Through Today or an End Date

Aamir Naveed AkramAamir Naveed Akram Nov 22, 2026 870 views

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.

Calculate Elapsed Days by Month in Excel Through Today or an End Date
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.
Before you start

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.

Solution 1Recommended

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.

1
Enter the dates

In Excel, enter the start date in A2, the optional end date in B2, and a date in the target month in C2.

2
Add the formula

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)).

3
Format and copy the result

Select D2 and choose Home > Number > General or Number. Drag the fill handle down to calculate additional rows.

4
Test both end-date cases

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.

Use EOMONTH to calculate days within each month
Inclusive day count: The +1 includes both boundary dates. The result is zero when the date range does not overlap the selected month.
Calculate monthly elapsed days

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. 1. Open your workbook: Open WPS Spreadsheet and choose Open to select your Excel workbook.
  2. 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. 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. 4. Format and save: Set D2 to General or Number format, then use File > Save As to save the workbook as an XLSX file.
Calculate monthly date overlaps with EOMONTH and TODAYOpen and save Microsoft Excel XLSX filesUse a familiar spreadsheet interfaceWork with formulas in a free office suite
microsoft office alternative - wps office

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.