Prevent #VALUE! Errors When Calculating Missing Time Differences in WPS Office Spreadsheets
Question details
The user needs an Excel-compatible formula that handles blank OutTime values and calculates wait time without returning a #VALUE! error.

- Product
- WPS Office Spreadsheets
- Device & OS
- not provided
- Scenario
- Calculating wait time between InTime and OutTime columns when some OutTime cells are blank.
- Observed behavior
- A direct subtraction such as F2-D2 returns #VALUE! when either referenced time cell is blank or cannot be evaluated as a numeric time.
Make sure your InTime and OutTime values are stored as real time values or valid time text, and identify the columns you will use in the formula before editing the worksheet.
Return a Blank Result When Either Time Cell Is Missing
Use this IF/OR formula when you want the wait-time cell to remain empty instead of showing #VALUE! if D2 or F2 is blank.
The OR function checks both referenced cells before subtraction, so WPS Office Spreadsheets does not attempt to subtract a blank or text value.
Open your workbook in WPS Office Spreadsheets and click the cell where the wait time should appear, such as G2.
Type =IF(OR(D2="",F2=""),"",F2-D2) and press Enter.
With the result cell selected, press Ctrl+1 or go to Home > Number Format > Time, then choose h:mm:ss.

Return Zero or Use D2 When Only OutTime Is Blank
Use this variant when you prefer a zero duration or want the formula to substitute D2 for a blank OutTime cell.
Use WPS Office Spreadsheets to Calculate Missing Time Differences Without #VALUE! Errors
You can perform the blank-safe time difference calculation directly in WPS Office Spreadsheets. Enter the IF/OR formula, apply h:mm:ss formatting, and get clean wait-time results without changing your workflow.
- 1. Open your workbook in WPS Office Spreadsheets: Launch WPS Office and open the .xlsx workbook containing the InTime and OutTime data.
- 2. Select the wait-time result cell: Click the first result cell, such as G2, where you want the calculated wait time to appear.
- 3. Enter the blank-safe time formula: Type =IF(OR(D2="",F2=""),"",F2-D2) and press Enter.
- 4. Copy the formula down: Drag the fill handle or double-click it to apply the formula to the remaining rows.
- 5. Format the result as time: Select the result range, go to Home > Number Format > Time, and choose h:mm:ss.

Frequently Asked Questions
Why does subtracting blank time cells return #VALUE! in WPS Office?
Because arithmetic such as F2-D2 cannot convert an empty string or text to a numeric serial time. Use =IF(OR(D2="",F2=""),"",F2-D2) to stop the subtraction when either cell is blank.
How do I return 0 instead of a blank cell when OutTime is missing?
Use =IF(OR(D2="",F2=""),0,F2-D2), then select the result cell and apply Home > Number Format > Time > h:mm:ss.
Can I treat a blank F2 as equal to D2 in the wait-time formula?
Yes. Use =IF(F2="",D2,F2)-D2. When F2 is blank, the formula substitutes D2, so the result is D2-D2 (0:00:00) and no #VALUE! error appears.
Which time format should I apply after entering the formula?
Select the formula cells, press Ctrl+1 or go to Home > Number Format > Time, and choose h:mm:ss. If total durations may exceed 24 hours, use the custom format [h]:mm:ss.




