Function Problems

How to Multiply Two Columns If Another Cell Contains Specific Text

John WilsonJohn Wilson Nov 10, 2026 869 views

Question details

The user needs to multiply the values of two columns and output the product in a third column, but only if a designated cell in the same row contains a specific text string.

How to Multiply Two Columns If Another Cell Contains Specific Text
Product
Spreadsheets
Device & OS
not provided
Scenario
Calculating a conditional product for specific rows based on text labels (e.g., "workover"), while leaving non-matching rows blank or as zero.
Observed behavior
The target column needs to automatically evaluate the text condition, calculate the product when true, and return zero or a blank cell when false.
Before you start

Ensure that the columns you are multiplying contain valid numeric values, and that the column containing the text criteria does not have trailing spaces.

Solution 1Recommended

Use the IF Function to Conditionally Multiply

The standard IF function evaluates a logical condition and returns the multiplied product if the condition is met, or an alternative value like 0 if it is not.

The IF function is the most straightforward method to perform math operations based on text matching. It uses the syntax IF(logical_test, value_if_true, value_if_false).

1
Select the target cell

Click on the cell in the destination column (e.g., H4) where you want the conditional product to appear.

2
Enter the IF formula

Type the formula `=IF(L4="WORKOVER", O4*P4, 0)` into the formula bar. Replace L4, O4, and P4 with your actual cell references.

3
Apply the formula to the column

Press Enter to calculate the first row. Then, click the small square at the bottom-right corner of the cell and drag it down to fill the formula for the rest of your data.

Use the IF Function to Conditionally Multiply
Leave Cells Blank Instead of Zero: If you prefer the non-matching rows to appear completely empty instead of showing a 0, replace the 0 in the formula with two double quotes: `=IF(L4="WORKOVER", O4*P4, "")`.
WPS Spreadsheet Formula Tutorial

Easily Manage Conditional Formulas with WPS Office

WPS Spreadsheet provides a seamless environment for writing and managing conditional logic. With intelligent formula suggestions and robust data processing, you can automate repetitive math operations instantly.

  1. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your workbook containing the data columns.
  2. 2. Insert the IF formula: Select the target output cell, type `=IF(`, and use the on-screen tooltips to select your text criteria cell, followed by your multiplication columns.
  3. 3. Auto-fill the column: Double-click the fill handle on the selected cell to instantly apply the conditional multiplication to hundreds of rows.
Fully compatible with Microsoft Excel functions like IF, IFS, and VLOOKUP.Intelligent formula autocomplete helps prevent syntax errors.Free and lightweight alternative to heavy spreadsheet software.Clean UI makes managing large datasets and complex calculations easy.
microsoft office alternative - wps office

Frequently Asked Questions

Is the text comparison in the IF function case-sensitive?

No, standard text comparisons in IF formulas are case-insensitive. Using "WORKOVER" in your formula will successfully match "workover", "Workover", or "WORKOVER".

How do I check for multiple text conditions before multiplying?

You can wrap an OR function inside your IF statement. For example, `=IF(OR(L4="WORKOVER", L4="DRILL"), O4*P4, 0)` will multiply columns O and P if column L says either 'workover' or 'drill'.

Why am I getting a #VALUE! error when the condition is met?

A #VALUE! error usually means that one of the cells you are trying to multiply contains text or a hidden space instead of a number. Double-check your numerical columns to ensure they are formatted as numbers and contain no stray characters.