Check Whether an Excel Time Is Between 20:00 and 22:00
Question details
Determine whether an Excel time falls between 20:00:00 and 22:00:00, including both endpoints.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants a formula that checks a time in a worksheet cell against an evening time range.
- Observed behavior
- The formula should return TRUE for times from 20:00:00 through 22:00:00 and FALSE for times outside that range.
Check that C2 contains a numeric Excel time or date-time value rather than text. If your time is in another cell, replace C2 in the formula with that cell reference.
Use AND to check the inclusive time range
Use this formula for a time or date-time in C2; it checks only the time portion.
Click an empty cell, such as D2, next to the time in C2.
Enter =AND(MOD(C2,1)>=TIME(20,0,0),MOD(C2,1)<=TIME(22,0,0)) in D2 and press Enter.
Drag the fill handle from D2 down to check the corresponding times in column C.
Use a start time stored in another cell
Use this option when Q2 contains the starting time and the range lasts two hours.
Check an inclusive time range in WPS Spreadsheet
Use the same AND, MOD, and TIME formula in WPS Spreadsheet to check whether a time falls between 20:00 and 22:00.
- 1. Open your workbook: Open WPS Spreadsheet and select your workbook, or create a new spreadsheet.
- 2. Enter a time: Enter a time or date-time value in cell C2.
- 3. Add the formula: Select D2, enter =AND(MOD(C2,1)>=TIME(20,0,0),MOD(C2,1)<=TIME(22,0,0)), and press Enter.
- 4. Check more rows: Drag the fill handle from D2 down to apply the formula to other entries in column C.

Frequently Asked Questions
Does the formula include 20:00 and 22:00?
Yes. The >= and <= operators include both endpoints, so exactly 20:00:00 and 22:00:00 return TRUE.
Will the formula work if C2 contains a date as well as a time?
Yes. In =AND(MOD(C2,1)>=TIME(20,0,0),MOD(C2,1)<=TIME(22,0,0)), MOD(C2,1) extracts the time portion of a numeric date-time value.
Why does my time formula return an error for a text value?
The formula expects a numeric time. If C2 contains recognizable time text, enter =TIMEVALUE(C2) in a helper cell and use that cell in the comparison.
Can I use HOUR instead of comparing full times?
A formula such as =OR(HOUR(C2)=20,HOUR(C2)=21) checks the hour, but it excludes exactly 22:00:00. Use the AND formula when both exact boundaries must be included.




