logo
search
Formula Errors

Excel Formula: Return Zero When Columns Contain F Instead of P

Maira MehtabMaira Mehtab Sep 20, 2026 868 views

Question details

The user needs a formula in column Y to return 0 when columns H, N, and T contain 'F' instead of 'P', while continuing its normal calculation otherwise.

Product
Spreadsheet
Device & OS
not provided
Scenario
Setting up a conditional formula that evaluates specific text values ('F' or 'P') across multiple columns before executing a VLOOKUP.
Observed behavior
The formula needs to output 0 when the text condition is met, overriding the default VLOOKUP calculation.
Before you start

Verify that your data range (such as columns H through T) is structured consistently and that you have identified the correct normal calculation formula to execute when 'F' is not present.

Solution 1Recommended

Return Zero When More Than One 'F' Appears

Use this method if the presence of 'F' in more than one column within your data range should trigger a zero result.

This solution utilizes the COUNTIF function nested inside an IF statement to check how many times 'F' appears in the specified range. If it appears more than once, it returns 0; otherwise, it proceeds with the standard IFERROR and VLOOKUP calculation.

1
Select the target cell

Click on the cell in column Y (e.g., Y14) where you want the formula result to appear.

2
Enter the IF and COUNTIF formula

Type the formula `=IF(COUNTIF(H14:T14,"F")>1,0,IFERROR(VLOOKUP(X14,ComPoint,2,TRUE),0))` into the formula bar.

3
Apply to other rows

Press Enter to execute. Click and drag the fill handle located at the bottom-right corner of the cell to apply the formula down the column.

Range Consideration: Using H14:T14 evaluates all columns between H and T. Ensure that the intermediate columns do not contain an unexpected 'F' that might falsely trigger the zero.
Advanced Formula Processing

Calculate Complex Formulas Seamlessly with WPS Spreadsheet

WPS Spreadsheet fully supports Excel functions like IF, COUNTIF, and VLOOKUP. You can easily handle conditional data formatting, complex nested calculations, and large datasets seamlessly.

  1. 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your workbook containing the data.
  2. 2. Select the target cell: Navigate to column Y where the conditional calculation is needed.
  3. 3. Enter the formula: Type your combined IF and COUNTIF formula and press Enter to evaluate.
  4. 4. Fill the column: Double-click the fill handle on the selected cell to automatically apply the formula to the rest of your data set.
100% compatible with Microsoft Excel formulas and file formats (.xlsx)Intuitive formula builder and syntax highlightingLightweight, fast, and free to use
microsoft office alternative - wps office

Frequently Asked Questions

What if my target columns (H, N, T) are not contiguous and other columns might contain 'F'?

If columns between H and T might contain 'F' and should be ignored, do not use the range H14:T14. Instead, use addition to check specific cells: `=IF((H14="F")+(N14="F")+(T14="F")>=1, 0, IFERROR(VLOOKUP(X14,ComPoint,2,TRUE),0))`.

Why does the formula include IFERROR and VLOOKUP?

The `IFERROR(VLOOKUP(...), 0)` segment represents your normal calculation when the 'F' condition is not met. If the VLOOKUP fails to find a match, IFERROR catches the #N/A error and outputs 0, keeping your spreadsheet clean.

Can I change 'F' to evaluate other text values or numbers?

Yes. The COUNTIF function is highly flexible. You can replace 'F' with any text string (enclosed in quotes), numeric value, or even a cell reference that contains the condition you want to check.