Formula Errors

Fix an Excel IF Formula Returning a Cell Reference Instead of a Time

Emma BrownEmma Brown Dec 2, 2026 868 views

Question details

Return the end time from C6 when it is at or before 4:00 PM, or return 4:00 PM when it is later.

Fix an Excel IF Formula Returning a Cell Reference Instead of a Time
Product
Microsoft Excel
Device & OS
not provided
Scenario
An IF formula compares an end time with a 4:00 PM cutoff.
Observed behavior
The result displays =C6 instead of the time stored in C6.
Before you start

Check that C6 contains a recognized Excel time value rather than text. Choose an unused cell, such as D1, for the 4:00 PM cutoff.

Solution 1Recommended

Reference the End-Time Cell Directly in the IF Formula

Use this formula to return the original end time or cap it at the time in D1.

A quoted entry such as "=C6" is text, so Excel displays those characters instead of retrieving the cell value. Use C6 without quotation marks or an equals sign inside the IF result.

1
Enter the cutoff time

Select D1, enter 4:00 PM, and press Enter.

2
Enter the IF formula

Select the result cell and enter =IF(C6="","",IF(C6>$D$1,$D$1,C6)).

3
Format the result as a time

Select the result cell, open Home > Number Format, and choose Time.

Reference the End-Time Cell Directly in the IF Formula
How the formula works: The formula leaves the result blank when C6 is blank, returns D1 when C6 is later than the cutoff, and otherwise returns C6. The dollar signs keep D1 fixed if you copy the formula.
Work with time formulas in WPS

Cap End Times at 4:00 PM in WPS Spreadsheet

Use the same IF formula in WPS Spreadsheet to return an end time or cap it at a cutoff, then format the result as a time.

  1. 1. Open the spreadsheet: Open your workbook in WPS Spreadsheet and locate the end time in C6.
  2. 2. Set the cutoff: Select D1, enter 4:00 PM, and press Enter.
  3. 3. Add the formula: Select the result cell and enter =IF(C6="","",IF(C6>$D$1,$D$1,C6)).
  4. 4. Apply time formatting: Select the result cell and choose Time from the number format options on the Home tab.
Use IF formulas to compare end times with a cutoff.Open and edit Microsoft Excel XLSX files.Format calculated results as readable times.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my IF formula display =C6 instead of the time?

The formula may contain "=C6" in quotation marks, which makes it text. Edit the formula and use C6 without quotation marks for the result.

What happens when the end time is exactly 4:00 PM?

The formula returns C6 because it uses the greater-than operator. Since C6 equals the cutoff, the displayed result is still 4:00 PM.

Why does the formula result appear as a decimal?

Excel stores times as numeric values. Select the result cell and choose Time under Home > Number Format to display it as a time.

Can I copy the formula down for other end times?

Yes. Drag the result cell's fill handle down. The C6 reference changes for each row, while $D$1 remains fixed on the cutoff cell.