WPS Spreadsheets: Calculate Numeric Totals When Cells Display Text
Question details
The user needs to calculate time totals and pay while displaying a lunch indicator without converting numeric time values into text.
- Product
- WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- A worksheet contains numeric time values, a lunch flag such as Y, and a display requirement for an L indicator on applicable rows.
- Observed behavior
- Combining a numeric time value with text causes calculation errors or prevents totals and pay calculations from working correctly.
Confirm that the time cells contain numeric spreadsheet time values rather than text, and place the lunch indicator in a separate cell or column. Identify the cells containing hours, the lunch flag, and the pay rate before entering the formulas.
Keep time values numeric and subtract the lunch break with a formula
Use this method when lunch rows need adjusted totals or pay calculations while retaining valid numeric time values.
Spreadsheet times are stored as fractions of a day, so a 30-minute break equals 1/48 of a day. Keep the lunch flag separate from the time value, then subtract the break only when the flag is present.
In WPS Spreadsheets, select the adjusted-time cell and enter a formula such as =B2-IF(C2="Y",1/48,0), replacing B2 with the numeric hours cell and C2 with the lunch flag cell.
Select the total cell and use AutoSum from the Home tab, or enter =SUM(D2:D20) if the adjusted times are in D2:D20.
In the pay cell, enter =ROUND(D2*E2,2), replacing D2 with adjusted time and E2 with the applicable rate. Format the result as currency if needed.
Change the lunch flag between Y and another value and confirm that the adjusted time changes by 1/48 of a day while the underlying cell remains numeric.
Display the lunch indicator with a custom number format
Use this option when the worksheet should visually show an L after lunch-row times without changing the stored numeric value.
Calculate Lunch-Adjusted Hours and Pay in WPS Spreadsheets
WPS Spreadsheets lets you preserve numeric time values, subtract conditional lunch breaks, display indicators through custom formats, and calculate totals or pay with familiar spreadsheet formulas.
- 1. Open the workbook: Launch WPS Office, choose Spreadsheet, and open the workbook containing the time records.
- 2. Separate values from labels: Keep the numeric time in one column and enter the lunch flag, such as Y, in a separate column.
- 3. Apply the adjustment formula: In the adjusted-time column, enter =B2-IF(C2="Y",1/48,0), then fill the formula down the required rows.
- 4. Format the display: Use Home > Number Format > More Number Formats to apply [h]:mm "L" where the lunch indicator should appear.
- 5. Calculate totals and pay: Use =SUM(D2:D20) for adjusted hours and =ROUND(D2*E2,2) for row-level pay calculations.

Frequently Asked Questions
Why does adding an L to a time value stop WPS Spreadsheets from calculating totals?
Appending L with a formula such as =B2&" L" converts the result into text. Keep the time numeric and use a custom number format such as [h]:mm "L" to display the indicator without changing the value.
How do I subtract a 30-minute lunch break only when a flag is present?
If B2 contains the numeric time and C2 contains Y for lunch, enter =B2-IF(C2="Y",1/48,0). A 30-minute period is 1/48 of a day in spreadsheet time calculations.
How can I total adjusted time values in WPS Spreadsheets?
Place the adjusted numeric results in one column, select the total cell, and choose Home > AutoSum, or enter a range formula such as =SUM(D2:D20). Apply the [h]:mm format if the total may exceed 24 hours.
Can I show the lunch indicator only on applicable rows?
Yes. Keep the lunch flag in a separate column, use Home > Conditional Formatting to highlight rows where the flag equals Y, and apply [h]:mm "L" to the relevant display cells or a dedicated display range.
How do I calculate pay from the adjusted time?
Multiply the numeric adjusted time by the rate, then round the result with a formula such as =ROUND(D2*E2,2). Format the result as currency from the Home tab if required.




