How to Multiply Two Columns If Another Cell Contains Specific Text
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.

- 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.
Ensure that the columns you are multiplying contain valid numeric values, and that the column containing the text criteria does not have trailing spaces.
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).
Click on the cell in the destination column (e.g., H4) where you want the conditional product to appear.
Type the formula `=IF(L4="WORKOVER", O4*P4, 0)` into the formula bar. Replace L4, O4, and P4 with your actual cell references.
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.

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. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your workbook containing the data columns.
- 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. Auto-fill the column: Double-click the fill handle on the selected cell to instantly apply the conditional multiplication to hundreds of rows.

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.




