Use a WPS Spreadsheets IF Formula to Calculate When a Cell Is Not Blank
Question details
Use a formula to leave R1 blank when L1 is empty and otherwise calculate M1 minus L1.

- Product
- WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- A spreadsheet needs to calculate the difference between two cells only when L1 has a value.
- Observed behavior
- R1 should appear blank when L1 is empty and display the result of M1 minus L1 otherwise.
Open the spreadsheet and locate cells L1, M1, and R1. Make sure R1 is available for the result and that L1 and M1 contain values suitable for subtraction.
Use IF to Check L1 Before Subtracting
Enter one formula in R1 to suppress the result until L1 has a value.
Click cell R1 in your spreadsheet.
Type =IF(L1="","",M1-L1) in R1 or in the formula bar, then press Enter.
Leave L1 empty to confirm that R1 appears blank, then enter a numeric value in L1 to calculate M1 minus L1.

Calculate Conditionally with IF in WPS Spreadsheets
Use WPS Spreadsheets to enter an IF formula that keeps the result visually blank until L1 has a value, then subtracts L1 from M1.
- 1. Open the spreadsheet: Open WPS Spreadsheets and select your workbook.
- 2. Select R1: Click cell R1, where you want the result to appear.
- 3. Enter the formula: Type =IF(L1="","",M1-L1) and press Enter.
- 4. Test the calculation: Enter values in L1 and M1 and check that R1 displays their difference. Clear L1 to confirm that R1 appears blank.

Frequently Asked Questions
What formula subtracts L1 from M1 only when L1 is not blank?
Enter =IF(L1="","",M1-L1) in R1 and press Enter. R1 appears blank when L1 is empty; otherwise, it displays M1 minus L1.
Is R1 truly empty when the formula returns a blank?
No. R1 still contains the IF formula, which returns an empty text string. Select R1 to see the formula in the formula bar.
What if L1 contains a formula that returns an empty string?
The test L1="" treats that result as blank, so R1 also displays an empty string.
Can I use the same formula in Microsoft Excel?
Yes. Enter =IF(L1="","",M1-L1) in cell R1 in Excel. WPS Spreadsheets can also open and edit Excel XLS and XLSX files.




