Formula Errors

Fix Excel Time Formula to Ignore Text Such as PTO and Return Zero Hours in WPS Spreadsheets

Adam DavisAdam Davis Nov 13, 2026 869 views

Question details

The user needs to adapt a WPS Spreadsheets time-calculation formula so text entries such as PTO, HOL, IN, and OFF do not trigger errors and are treated as zero hours.

Fix Excel Time Formula to Ignore Text Such as PTO and Return Zero Hours
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
Managing a time sheet or attendance workbook where shift start/end cells may contain text codes like PTO, HOL, IN, or OFF instead of actual times.
Observed behavior
The current time-calculation formula produces an error when it subtracts or compares text cells, breaking total and overtime calculations.
Before you start

Open the workbook in WPS Spreadsheets and identify the time-pair cells, for example C10 and B10, and the total-hours cell that contains the formula. Confirm which cells can contain text codes such as PTO, HOL, IN, or OFF so you wrap every relevant time calculation.

Solution 1Recommended

Wrap Each Time Pair in IFERROR to Return Zero Hours

Use this when the existing formula works for real times but returns #VALUE! or other errors for text entries such as PTO, HOL, IN, or OFF.

This method keeps your current shift-length and overtime logic intact. IFERROR catches the text-related error and returns 0 for that time pair, so text codes contribute zero hours instead of breaking the total.

1
Select the total-hours formula cell

Click the cell that contains the time calculation, for example S10, then click in the formula bar or press F2 to edit it.

2
Wrap the time difference expression

Type =IFERROR( immediately before the existing calculation and add ,0) at the end. For example: =IFERROR(IF(C10-B10>TIME(5,0,0),C10-B10-TIME(0,30,0),C10-B10),0).

3
Apply the same wrapper to every time pair

For each additional time-pair expression in the formula, wrap it with IFERROR(...,0) so text codes such as PTO or HOL return zero hours.

4
Format the result as time

Press Enter, select the result cell, press Ctrl+1, choose Time, and pick a suitable time format so the returned value displays correctly.

5
Create decimal and overtime calculations

If S10 holds the total time, enter =TEXT(S10*24,"0.00") in P10 to get numeric hours, then reference P10 or the same numeric conversion in Q10 for overtime.

Wrap Each Time Pair in IFERROR to Return Zero Hours
Result: Text entries like PTO now contribute 0:00 to the total instead of producing formula errors.
WPS Spreadsheets formula fix

Create a Text-Safe Time Sheet Formula in WPS Spreadsheets

Use WPS Spreadsheets to open your existing time sheet and apply IFERROR wrappers so PTO, HOL, IN, and OFF entries return zero hours. WPS handles the same Excel formulas and formatting while keeping the workbook compatible with Microsoft Excel files.

  1. 1. Download and install WPS Office: Go to the official WPS Office website, download the free Windows/macOS/Linux version, and install WPS Spreadsheets.
  2. 2. Open your Excel time sheet: Launch WPS Spreadsheets, click Menu > Open, and select the .xlsx or .xls workbook that contains the time formulas.
  3. 3. Edit the formula and apply IFERROR: Select the total-hours cell, click the formula bar, and wrap each time calculation with IFERROR(...,0) using the pattern described above.
  4. 4. Save in Excel-compatible format: Click Menu > Save As, choose Excel Workbook (.xlsx), and keep the file ready for Microsoft Excel or WPS Office.
Keeps time-sheet formulas working when cells contain PTO, HOL, IN, or OFFSupports the same IFERROR, TIME, and TEXT functions used in Microsoft ExcelMaintains full compatibility with .xlsx and .xls time-sheet workbooksFree and lightweight for editing and formatting attendance filesFamiliar ribbon and formula bar make it easy to locate and modify formulas
microsoft office alternative - wps office

Frequently Asked Questions

Why does my time formula show #VALUE! when a cell contains PTO?

Because subtracting or comparing text such as PTO with a time value is not a valid numeric operation. Wrap the operation in IFERROR(...,0) or use ISTEXT to test the cell and return 0.

How do I make PTO, HOL, IN, and OFF all count as zero hours in a weekly total?

Wrap each daily time calculation in IFERROR(...,0). For example: =IFERROR(IF(C10-B10>TIME(5,0,0),C10-B10-TIME(0,30,0),C10-B10),0), then sum the daily results.

Can WPS Spreadsheets use the same IFERROR formula as Excel?

Yes. WPS Spreadsheets supports IFERROR, TIME, TEXT, and other Excel functions, so you can use the same formulas in both applications.

How do I display total hours as a decimal number after the formula is fixed?

If S10 contains the total time, enter =TEXT(S10*24,"0.00") in another cell. This converts a time value to numeric hours such as 8.50.

What format should the result cell use?

Select the cell, press Ctrl+1, choose Time, and pick a format such as 13:30 or 37:30:55. For decimal hours, use the TEXT formula or number format instead.