logo
search
Function Problems

How to Use COUNTIFS to Count Appointments During a Time Shift in Excel

Natalie TaylorNatalie Taylor Sep 28, 2026 870 views

Question details

The user needs a method to count the number of appointments that fall within specific shift hours using Excel formulas.

How to Use COUNTIFS to Count Appointments During a Time Shift
Product
Excel
Device & OS
not provided
Scenario
Tracking and tallying scheduled appointments that start or end during a designated time shift.
Observed behavior
Standard text-based time criteria fail to calculate properly in COUNTIFS because the formula requires numeric time evaluation to compare greater-than or less-than logic.
Before you start

Ensure that the cells containing your appointment times are formatted as proper Time or Custom values, rather than plain text strings.

Solution 1Recommended

Calculate Shift Appointments Using COUNTIFS and TIMEVALUE

Convert text time criteria into numeric values Excel can calculate by combining COUNTIFS with the TIMEVALUE function.

When comparing time values in Excel functions like COUNTIFS, using plain text criteria (like "2:00 PM") often leads to incorrect results or errors. By wrapping the time in the TIMEVALUE function, you instruct Excel to treat it as a numerical serial value, which can then be properly evaluated with greater-than or less-than operators.

1
Select the target cell

Open your Excel workbook and click on the blank cell where you want to display the total appointment count.

2
Start the COUNTIFS formula

Type =COUNTIFS( to begin the formula and select your first criteria range, such as the column containing your appointment locations or categories.

3
Add the start time logic

Add your time condition by selecting the column with the appointment times, followed by a comma, and typing the start time logic: ">="&TIMEVALUE("2:00 PM").

4
Add the end time logic

Set the end of the shift by referencing the same time column again, followed by a comma and the end time logic: "<"&TIMEVALUE("5:00 PM").

5
Execute the formula

Close the parentheses and press Enter. The complete formula should look like: =COUNTIFS(A2:A100,"Appt", B2:B100, ">="&TIMEVALUE("2:00 PM"), B2:B100, "<"&TIMEVALUE("5:00 PM")).

Calculate Shift Appointments Using COUNTIFS and TIMEVALUE
Formula Tip: Make sure to enclose your logical operators (such as ">=", "<") in quotes and join them to the TIMEVALUE function using the ampersand (&) symbol.
Advanced Formula Support

Count Shift Data Effortlessly in WPS Spreadsheet

WPS Spreadsheet perfectly processes complex formulas like COUNTIFS and TIMEVALUE, allowing you to manage schedules, track shifts, and analyze time-based data without errors.

  1. 1. Open your schedule: Launch WPS Spreadsheet and open the document containing your appointment data.
  2. 2. Select a calculation cell: Click on the cell where you want the final shift tally to appear.
  3. 3. Enter the formula: Type your =COUNTIFS formula utilizing the TIMEVALUE function to properly handle time comparisons.
  4. 4. Calculate the result: Press the Enter key to instantly calculate and display the number of scheduled appointments during that shift.
100% compatible with Microsoft Excel formulas, formatting, and time values.Effortlessly handle large appointment datasets and complex time logic.Free and lightweight spreadsheet tool with an intuitive, familiar interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my COUNTIFS formula return 0 when comparing times?

This happens when Excel reads your time criteria as plain text. By wrapping your time string (like "2:00 PM") in the TIMEVALUE function, Excel converts it into a decimal number that can be mathematically compared.

Can I reference a cell containing the shift time instead of typing it in the formula?

Yes. If your start time is located in cell D1, you can simply write ">="&D1 as your criteria. You do not need to use the TIMEVALUE function if the referenced cell is already formatted as a valid time.

How do I handle a time shift that crosses past midnight?

Because a post-midnight end time is numerically smaller than a pre-midnight start time, a standard COUNTIFS range will fail. You must split your calculation into two separate COUNTIFS formulas (one from the start time to 11:59 PM, and another from 12:00 AM to the end time) and add them together using a plus sign (+).