Excel Formula to Check Whether a Time Gap Is 15 Minutes or Less
Question details
Display Pass or Fail based on whether the difference between date and time values in columns A and B is 15 minutes or less.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains pairs of date and time values that need to be checked against a 15-minute threshold.
- Observed behavior
- The desired result is Pass for a qualifying time difference and Fail for a difference greater than 15 minutes.
Make sure columns A and B contain valid Excel date and time values rather than text. Decide whether the order of the values matters; include dates when comparing times across midnight.
Use an IF Formula to Compare the Time Difference
Use this formula when the value in column A is expected to be later than or equal to the value in column B.
Select cell C2 and enter =IF(A2-B2<=TIME(0,15,0),"Pass","Fail"), then press Enter.
Select C2, then choose General from the Number Format list on the Home tab. The formula returns text, not a time value.
Drag the fill handle at the bottom-right corner of C2 down column C to check the remaining rows.

Check the Gap Regardless of Which Time Is Later
Use ABS when you want to measure the time gap without considering the order of the values.
Check 15-Minute Time Gaps in WPS Spreadsheets
Use the same IF and TIME functions in WPS Spreadsheets to label date and time differences as Pass or Fail.
- 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
- 2. Enter the formula: Select C2 and enter =IF(ABS(A2-B2)<=TIME(0,15,0),"Pass","Fail"), then press Enter.
- 3. Apply it to the remaining rows: Drag the fill handle from C2 down column C to check the other pairs of values.
- 4. Save the workbook: Choose File > Save or Save As to save the results in your preferred workbook format.

Frequently Asked Questions
Does exactly 15 minutes return Pass?
Yes. The <= operator includes a difference of exactly 15 minutes.
How can I check the gap if either time might be later?
In C2, use =IF(ABS(A2-B2)<=TIME(0,15,0),"Pass","Fail"). ABS removes the sign of the difference.
How do I compare times across midnight?
Include the date with each time in columns A and B. For example, use values from consecutive dates for 11:55 PM and 12:05 AM so the subtraction reflects a 10-minute gap.
Why does the formula not calculate as expected?
Check that A2 and B2 contain valid Excel date and time values rather than text. You can also select C2 and choose General from the Home tab's Number Format list for the Pass or Fail result.




