logo
search
Formula Errors

How to Calculate Price from Different Cells Using an Excel IF Formula

Amos GikundaAmos Gikunda Oct 22, 2026 868 views

Question details

The user needs to calculate a price using an IF function where the multiplier changes depending on which cell (E12 or F12) contains a value.

How to Calculate Price from Different Cells Using an Excel IF Formula
Product
Excel
Device & OS
not provided
Scenario
Calculating dynamic pricing or costs based on data entered in mutually exclusive or prioritized columns.
Observed behavior
The goal is to automatically output E12 multiplied by 35 if E12 is not blank; otherwise, output F12 multiplied by 32.
Before you start

Ensure your data is structured correctly and decide which cell (E12 or F12) should take priority in the calculation if both happen to contain values by accident.

Solution 1Recommended

Use the IF Function with a Not-Blank Logical Test

Apply a standard IF formula using the not-equal-to-blank (<>"") operator to determine which calculation Excel should perform.

The IF function evaluates a logical test and returns one value if the test is true, and another if it is false. By testing if the primary cell is not blank, Excel can conditionally apply different multipliers to your data.

1
Select the target cell

Click on the cell where you want the calculated price to appear (for example, G12).

2
Enter the IF formula

Type the formula `=IF(E12<>"", E12*35, F12*32)` into the formula bar at the top of the window.

3
Apply the calculation

Press Enter to apply the formula. If E12 has a value, Excel multiplies it by 35; if E12 is empty, Excel multiplies F12 by 32.

4
Fill the formula down

Click and hold the small square at the bottom-right corner of cell G12, and drag it down to apply this conditional calculation to other rows.

Use the IF Function with a Not-Blank Logical Test
Priority Handling: This formula inherently prioritizes cell E12. If both E12 and F12 contain values simultaneously, the formula will only calculate E12*35 and ignore F12.
Efficient Spreadsheet Calculations

Calculate Conditional Formulas Effortlessly with WPS Spreadsheet

WPS Spreadsheet provides robust support for all standard logical functions like IF, IFS, and nested formulas, allowing you to handle dynamic pricing calculations with ease.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your pricing data.
  2. 2. Enter the conditional formula: Click on your target result cell and input `=IF(E12<>"", E12*35, F12*32)`.
  3. 3. Execute the function: Press the Enter key to view the dynamically calculated result immediately.
  4. 4. Apply to the dataset: Double-click the fill handle in the corner of the cell to instantly apply the logic across your entire dataset.
Fully compatible with Microsoft Excel formulas and .xlsx workbook formats.Built-in syntax guidance helps you quickly write error-free IF formulas.Lightweight, fast, and completely free for everyday data analysis.
microsoft office alternative - wps office

Frequently Asked Questions

What if neither E12 nor F12 contains a value?

With the formula `=IF(E12<>"", E12*35, F12*32)`, if both cells are empty, Excel treats the empty F12 cell as a zero and returns 0 (0 * 32 = 0). To display a blank cell instead of a zero when both are empty, use a nested IF: `=IF(E12<>"", E12*35, IF(F12<>"", F12*32, ""))`.

How do I add a third condition for another cell, like G12?

You can use nested IF statements or the IFS function. For example, to check E12, then F12, then G12, you can use: `=IFS(E12<>"", E12*35, F12<>"", F12*32, G12<>"", G12*20)`.

Why is my IF formula returning a #VALUE! error?

This error occurs if the cells being referenced (E12 or F12) contain text strings instead of numbers. Ensure that the cells you are multiplying only contain numeric values.

How can I make the formula check if a cell specifically contains a number instead of just being not blank?

You can use the ISNUMBER function combined with your IF statement. The formula would be `=IF(ISNUMBER(E12), E12*35, IF(ISNUMBER(F12), F12*32, ""))`. This prevents math errors if someone accidentally types text into the cells.