How to Use Excel IF Formula to Multiply Columns Based on Text Condition
Question details
The user needs to perform a conditional calculation, specifically multiplying two columns in a target column, but only if a specific text string ('workover') is present in a reference column.

- Product
- Excel / WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- Automating conditional mathematical calculations based on text criteria within a spreadsheet to dynamically populate data.
- Observed behavior
- The target cell calculates the product of two specific columns when the text condition is met, and returns zero or remains blank otherwise.
Ensure that the columns you intend to multiply contain valid numeric data, as multiplying text or incorrectly formatted numbers will result in a #VALUE! error.
Use the IF Function with a Zero Fallback
Use a standard IF formula to check for the text condition, multiply the target cells if true, and return a 0 if false. This is best for financial or strict numerical datasets.
The IF function evaluates a logical test. When the criteria are met, it performs the designated action (multiplication). When the criteria fail, it outputs a default value.
Click on cell H2, which is the starting cell in your target column where the calculation will appear.
Type the formula =IF(L2="workover", O2*P2, 0) into the formula bar. Ensure the text condition is wrapped in double quotes.
Press Enter to execute the formula. If L2 contains the exact word, you will see the multiplied result of O2 and P2.
Click and drag the fill handle (the small square at the bottom-right corner of cell H2) down the column to apply the formula to the remaining rows.

Use the IF Function with a Blank Cell Fallback
Modify the IF formula to return an empty string instead of a zero when the condition is not met, keeping your spreadsheet visually cleaner for presentations.
Handle Complex Formulas Easily with WPS Spreadsheet
WPS Spreadsheet provides robust support for logical functions like IF, nested formulas, and data analysis tools, making it incredibly easy to process conditional calculations quickly and accurately without formatting issues.
- 1. Open your dataset: Launch WPS Spreadsheet and open the document containing your data.
- 2. Select the output cell: Click on the cell where you want the conditional multiplication result to appear.
- 3. Enter the condition: Type the formula =IF(L2="workover", O2*P2, 0) and press Enter.
- 4. Drag to fill: Double-click the fill handle to automatically apply the conditional calculation to your entire column.

Frequently Asked Questions
What if my text condition is case-sensitive?
The standard IF function is not case-sensitive, meaning 'workover' and 'WORKOVER' will both trigger the calculation. If you need an exact case match, use the EXACT function nested inside IF: =IF(EXACT(L2,"workover"), O2*P2, 0).
How do I multiply if the cell contains the text as part of a longer sentence?
To check for a partial text match (e.g., 'morning workover shift'), you need to combine the ISNUMBER and SEARCH functions within your IF statement: =IF(ISNUMBER(SEARCH("workover", L2)), O2*P2, 0).
Why is my formula returning a #VALUE! error?
A #VALUE! error typically occurs if the cells you are attempting to multiply contain text characters or hidden spaces instead of pure numbers. Ensure that your numerical columns (O and P) are formatted as numbers and contain no text data.
Can I check for multiple different text conditions?
Yes. You can use the OR function inside your IF logical test. For example, to multiply the cells if column L contains either 'workover' or 'maintenance', use the formula: =IF(OR(L2="workover", L2="maintenance"), O2*P2, 0).




