logo
search
Calculation Issues

How to Calculate the Number of Days in July Between Two Dates in Excel

Maira MehtabMaira Mehtab Sep 21, 2026 868 views

Question details

The user needs an Excel formula to count the exact number of days in July that fall within a given date range.

Product
Excel
Device & OS
not provided
Scenario
Tracking or reporting on metrics that require isolating the number of days specifically falling in the month of July between a start and end date.
Observed behavior
The formula must include the relevant endpoints and return zero when the specified date range does not overlap with July.
Before you start

Ensure that your start and end dates are formatted as valid Excel dates, not as text, to avoid calculation errors and zero values.

Solution 1Recommended

Use the MAX and MIN Formula for Specific Month Calculation

This robust formula isolates the days in July between two dates and correctly returns zero if there is no overlap.

This formula works by finding the overlapping period between your specific date range and the absolute start and end dates of July for the given year.

1
Enter your dates

Place your start date in cell O2 and your end date in cell P2.

2
Apply the formula

In an empty cell where you want the result, enter the formula: =MAX(0,MIN(P2,DATE(YEAR(P2),7,31))-MAX(O2,DATE(YEAR(O2),7,1))+1)

3
Press Enter

Press the Enter key to execute the formula. It will return the number of days that fall in July.

Adjust Cell References: Adjust the cell references 'O2' and 'P2' in the formula to match the exact locations of your start and end dates in your workbook.
Effortless Date Calculations

Calculate Dates Easily with WPS Spreadsheet

WPS Spreadsheet fully supports advanced date and time functions, allowing you to calculate overlapping days, manage schedules, and process data effortlessly.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open your document containing the start and end dates.
  2. 2. Select a target cell: Click on the blank cell where you want the July days calculation result to appear.
  3. 3. Input the date formula: Type the formula =MAX(0,MIN(P2,DATE(YEAR(P2),7,31))-MAX(O2,DATE(YEAR(O2),7,1))+1) into the formula bar.
  4. 4. Execute and fill: Press Enter to get the result, then click and drag the fill handle down to apply the calculation across other date ranges.
Fully compatible with Microsoft Excel formulas and date formatsBuilt-in function wizard to easily construct complex formulasFree to use with a lightweight and user-friendly interfaceSupports cross-platform data syncing across Windows, Mac, and mobile
microsoft office alternative - wps office

Frequently Asked Questions

Why does the formula return an error or zero when there is an overlap?

This usually happens when the dates in your cells are stored as text strings instead of valid Excel dates. You can fix this by selecting the cells, right-clicking to choose 'Format Cells', and applying the 'Date' format.

Can I adapt this formula to calculate days for a different month?

Yes. To calculate days for another month, change the month argument (currently '7' for July) and the end-of-month day (currently '31') in the DATE functions within the formula to match your desired month.

Does the formula include the start and end dates in the count?

Yes, the addition of '+1' at the end of the MIN and MAX equation ensures that the calculation is inclusive of both the start and end endpoints if they fall within July.