Excel IF Formula for Product Prices and a Fallback Calculation
Question details
Return fixed prices for three product codes or calculate a fallback value when G59 is numeric.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet stores a product code in C59 and values for a fallback calculation in G59 and L59.
- Observed behavior
- The formula should return 9750 for WW-1, 5200 for WW-2, or 5600 for WW-3. For other codes, it should return G59 plus L59 if G59 is numeric, or a blank result otherwise.
Check that C59 contains the product code and that G59 and L59 contain the values used in the fallback calculation. If G59 is numeric, L59 must also be a value that Excel can add without an error.
Use a Nested IF Formula to Return Prices or Calculate a Fallback
Use this formula when the three product codes and their fixed prices can be entered directly in the formula.
In Excel, select the cell where you want the price or calculated value to appear.
Type =IF(C59="WW-1",9750,IF(C59="WW-2",5200,IF(C59="WW-3",5600,IF(ISNUMBER(G59),G59+L59,"")))) and press Enter.
Compare the result with the code in C59. For an unmatched code, check that the cell returns G59+L59 when G59 is numeric and appears blank otherwise.
If needed, drag the result cell's fill handle to other rows. Excel will adjust the row references for each copied formula.

Calculate Product Prices with IF in WPS Spreadsheet
Use the same nested IF and ISNUMBER formula in WPS Spreadsheet to return fixed product prices or a fallback calculation.
- 1. Open the worksheet: Open WPS Spreadsheet and select Open to load your workbook.
- 2. Select a result cell: Click the cell where you want the price or fallback value to appear.
- 3. Enter the formula: Type =IF(C59="WW-1",9750,IF(C59="WW-2",5200,IF(C59="WW-3",5600,IF(ISNUMBER(G59),G59+L59,"")))) and press Enter.
- 4. Review and save: Check the result against C59, G59, and L59, then select Save to keep the formula in your workbook.

Frequently Asked Questions
What happens if the product code does not match any of the three codes?
The formula checks G59 with ISNUMBER. If G59 is numeric, it returns G59+L59; otherwise, it returns an empty string that appears blank.
Why does the fallback calculation show an error?
The formula checks whether G59 is numeric but does not check L59. Review both cells, especially L59, for text or errors that prevent addition.
Can I use a lookup table instead of nested IF statements?
Yes. In Microsoft 365, you can store codes and prices in a table named PriceTable and use =IFERROR(XLOOKUP(C59,PriceTable[Code],PriceTable[Price]),IF(ISNUMBER(G59),G59+L59,"")) as an alternative. IFERROR also triggers the fallback for other XLOOKUP errors, not just missing codes.
How do I use the formula for more rows?
Select the cell containing the formula and drag its fill handle down. The references to C59, G59, and L59 will adjust to each row.




