How to Fix COUNTIFS Returning Zero for Time Intervals in Excel
Question details
The user needs to troubleshoot a COUNTIFS formula that returns zero when counting time values within a range, usually because times are stored as text or the boundary cells are not valid Excel times.

- Product
- WPS Office Spreadsheets
- Device & OS
- not provided
- Scenario
- The user is counting records between two time-of-day boundaries on a worksheet and needs the COUNTIFS result to return the correct interval count.
- Observed behavior
- The COUNTIFS formula returns zero even when matching time values appear in the source column, often because the source data is text or the time boundaries are not real numeric times.
Before editing the formula, verify that the boundary cells and source column contain numeric time values instead of text. Select a cell and check the Number Format box on the Home tab, or use =ISNUMBER(cell) in a helper cell to test whether the value is numeric.
Use correct inclusive and exclusive time boundaries in COUNTIFS
Use this solution when the source time column and boundary cells already contain valid Excel time values, but the formula still returns zero.
COUNTIFS treats time values as decimal fractions of a day. To count times from A2 up to but not including A3, combine ">=" with the lower boundary and "<" with the upper boundary.
Type the start time in cell A2 and the end time in cell A3, select both cells, and choose a Time format from the Number Format drop-down on the Home tab.
Click the result cell, type =COUNTIFS('Sheet 1'!G:G,">="&A2,'Sheet 1'!G:G,"<"&A3) in the formula bar, and press Enter.
Change a source time to a value inside the interval and confirm the count updates. If it still returns zero, check the source column for text values.

Convert text-based times to numeric Excel times before counting
Use this solution when times in the source column are stored as text or imported, so COUNTIFS cannot evaluate them as time values.
Convert an entire imported time column with Text to Columns
Use this solution when a whole source column was pasted or imported as text and you want to fix it in place.
Fix COUNTIFS time interval counting in WPS Office Spreadsheets
You can solve COUNTIFS time interval zero results directly in WPS Office Spreadsheets. WPS Office supports Excel-compatible formulas, opens and edits .xlsx files, and keeps the same time criteria behavior, so you can correct the formula without changing your workflow.
- 1. Open the workbook in WPS Office Spreadsheets: Launch WPS Office, click Open, and select the workbook that contains the COUNTIFS formula.
- 2. Check the time cells: Select the boundary cells and source column, then use the Number Format drop-down on the Home tab to confirm or apply the Time format.
- 3. Enter the corrected COUNTIFS formula: Click the result cell, type the COUNTIFS formula with inclusive and exclusive time boundaries in the formula bar, and press Enter.
- 4. Review the count: Verify that the returned count matches the time interval and that the source cells are numeric times rather than text.

Frequently Asked Questions
Why does COUNTIFS return zero when my times look correct?
The likely cause is that the source cells or boundary cells are stored as text, not real Excel times. Select the cells and check the Number Format box on the Home tab, or use =ISNUMBER(cell) to test whether they are numeric.
How do I write COUNTIFS to include the start time and exclude the end time?
Use =COUNTIFS('Sheet 1'!G:G,">="&A2,'Sheet 1'!G:G,"<"&A3). This counts times greater than or equal to A2 and less than A3.
How do I convert text times to real times in WPS Office Spreadsheets?
Use =TIMEVALUE(cell) in a helper column and paste the results as values over the original cells. Alternatively, select the column, go to the Data tab, click Text to Columns, and finish the conversion.
Does COUNTIFS work across sheets in WPS Office?
Yes. You can reference another sheet with the sheet name and range as in 'Sheet 1'!G:G, just like in Microsoft Excel.
What should I do if the source time column is formatted as text?
Change the format to Time after converting the values. Use Text to Columns on the Data tab or TIMEVALUE in a helper column to convert text times to numeric time values.




