Formula Errors

Excel Formula to Check Whether a Time Gap Is 15 Minutes or Less

Chanuka GeekiyanageChanuka Geekiyanage Nov 20, 2026 868 views

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.

Check Whether a Time Gap Is 15 Minutes or Less in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Enter the formula

Select cell C2 and enter =IF(A2-B2<=TIME(0,15,0),"Pass","Fail"), then press Enter.

2
Set the result format

Select C2, then choose General from the Number Format list on the Home tab. The formula returns text, not a time value.

3
Apply it to other rows

Drag the fill handle at the bottom-right corner of C2 down column C to check the remaining rows.

Use an IF Formula to Compare the Time Difference
Check the value order: The formula returns Pass for any negative difference, even if the values are more than 15 minutes apart. If either value can be later, use the absolute-difference formula instead.
WPS Spreadsheets

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. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
  2. 2. Enter the formula: Select C2 and enter =IF(ABS(A2-B2)<=TIME(0,15,0),"Pass","Fail"), then press Enter.
  3. 3. Apply it to the remaining rows: Drag the fill handle from C2 down column C to check the other pairs of values.
  4. 4. Save the workbook: Choose File > Save or Save As to save the results in your preferred workbook format.
Check each time gap against a 15-minute thresholdOpen and edit Microsoft Excel XLSX and XLS filesCopy a formula down a column using the fill handleWork in a familiar spreadsheet interface
microsoft office alternative - wps office

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.