Formula Errors

Count Times Between Two Values in Excel with COUNTIFS or SUMPRODUCT

Olivia MillerOlivia Miller Dec 2, 2026 869 views

Question details

Count alarm occurrences in a single Excel column between two specified times without a formula parse error.

Count Times Between Two Values in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
Alarm times are stored in column D on the September worksheet, and the user wants to count entries between times such as 6:00 a.m. and 12:00 p.m.
Observed behavior
A formula parse error prevents the user from calculating the count.
Before you start

Enter the start time in D1 and the end time in E1 on the worksheet where you will enter the formula. Confirm that September!D2:D1500 contains real time values rather than text and that the start time is earlier than the end time.

Solution 1Recommended

Count the time range with COUNTIFS

Use COUNTIFS to apply both time boundaries to the same column.

1
Enter the time boundaries

In the worksheet where you want the result, enter 6:00 AM in D1 and 12:00 PM in E1, or use your own start and end times.

2
Enter the formula

Select an empty result cell and enter =COUNTIFS(September!D2:D1500,">"&D1,September!D2:D1500,"<"&E1). Press Enter.

3
Check the result

Compare the result with the times in September!D2:D1500. Adjust the range in both parts of the formula if your data extends beyond row 1500.

Count the time range with COUNTIFS
Boundary and date handling: The formula excludes times exactly equal to D1 or E1. Use ">=" and "<=" to include them. It assumes the source cells contain time-only values; date-and-time values include a date component and need different handling.
Count times in WPS Spreadsheets

Count alarm times in WPS Spreadsheets

Open your workbook in WPS Spreadsheets and use COUNTIFS to count time values between two cell-based boundaries.

  1. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
  2. 2. Enter the boundaries: On the worksheet for your result, enter the start time in D1 and the end time in E1.
  3. 3. Count the times: Select an empty cell and enter =COUNTIFS(September!D2:D1500,">"&D1,September!D2:D1500,"<"&E1), then press Enter.
  4. 4. Save the workbook: Use File > Save As to save the updated workbook in XLSX format if needed.
Count alarm times with familiar COUNTIFS formulasOpen and save Microsoft Excel XLSX workbooksEdit spreadsheets in a familiar interfaceUse WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

How do I include alarms exactly at the start and end times?

In the COUNTIFS formula, replace ">" with ">=" and "<" with "<=". This includes values equal to D1 or E1.

Why does Excel report a formula parse error?

Check that comparison operators are enclosed in quotes and joined to cell references with &, as in ">"&D1. If your Excel regional settings use semicolons as argument separators, replace the commas between COUNTIFS arguments with semicolons.

Why are visible times not being counted?

Check whether the source cells contain actual time values rather than text. Also check whether they contain dates as well as times: these formulas compare the full stored value, not just the displayed time.

Can these formulas count a range that crosses midnight?

Not as written. They require the start time in D1 to be earlier than the end time in E1. A range such as 10:00 PM to 6:00 AM needs separate tests for times after the start or before the end.