Function Problems

Excel IF Formula for Product Prices and a Fallback Calculation

Amos GikundaAmos Gikunda Nov 18, 2026 869 views

Question details

Return fixed prices for three product codes or calculate a fallback value when G59 is numeric.

Use an Excel IF Formula for Product Prices and a Fallback Calculation
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the result cell

In Excel, select the cell where you want the price or calculated value to appear.

2
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.

3
Check the result

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.

4
Apply it to other rows

If needed, drag the result cell's fill handle to other rows. Excel will adjust the row references for each copied formula.

Use a Nested IF Formula to Return Prices or Calculate a Fallback
Check the fallback inputs: ISNUMBER checks G59 only. If G59 is numeric but L59 contains text that cannot be added, the fallback calculation can return an error.
Calculate prices in WPS Spreadsheet

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. 1. Open the worksheet: Open WPS Spreadsheet and select Open to load your workbook.
  2. 2. Select a result cell: Click the cell where you want the price or fallback value to appear.
  3. 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. 4. Review and save: Check the result against C59, G59, and L59, then select Save to keep the formula in your workbook.
Return fixed prices for product codes with a nested IF formula.Calculate a fallback value only when G59 is numeric.Open and save Microsoft Excel XLSX files.Use a familiar spreadsheet interface to review and fill formulas.
microsoft office alternative - wps office

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.