Formula Errors

How to Fix Excel IF OR Formula Always Returning False

Adam DavisAdam Davis Nov 3, 2026 870 views

Question details

The user needs to fix an Excel IF and OR formula that consistently returns the false result rather than the expected logical output.

How to Fix Excel IF OR Formula Always Returning False
Product
Microsoft Excel
Device & OS
not provided
Scenario
Writing an IF/OR formula to assign specific numeric values (like 4 or 1) based on multiple text codes (e.g., E1, E2, F3) in a target cell.
Observed behavior
The formula evaluates to false and returns the alternate value even when the expected text is present, usually because the cell contains combined text strings or hidden whitespace.
Before you start

Ensure that the cells you are referencing do not contain accidental leading or trailing spaces, as standard formula logic requires an exact text match to evaluate as true.

Solution 1Recommended

Remove Hidden Spaces and Use Array Constants

Clean up hidden whitespace that breaks exact matches and simplify your IF/OR conditions using array constants.

Standard IF formulas compare the entire cell contents. If your cell contains 'E1 ', it will not equal 'E1'. Removing spaces and grouping variables with array constants streamlines your formula.

1
Trim existing data

Select an adjacent empty column and use the =TRIM(C22) function to remove any extra spaces from your target cells, then paste the values back as text.

2
Enter the array constant formula

Select the cell where you want the result and enter the simplified formula: =IF(OR(C22={"E1","E2","LT1","R4"}),4,IF(OR(C22={"F3","F7"}),1,"n/a"))

3
Apply the formula

Press Enter to calculate the result, then click and drag the fill handle in the bottom-right corner of the cell to apply this formula to the rest of your column.

Remove Hidden Spaces and Use Array Constants
Text vs. Numbers: Make sure your formula outputs a true numeric value (e.g., 4) rather than text (e.g., "4") so it can be used in downstream calculations.
Easy Formula Troubleshooting

Easily Write and Troubleshoot Formulas with WPS Spreadsheet

WPS Spreadsheet provides powerful formula auditing tools and full function support, making it simple to fix logical errors like IF/OR false results without complicated workarounds.

  1. 1. Install WPS Office: Download and install WPS Office for free from the official website.
  2. 2. Open your workbook: Launch WPS Spreadsheet and open your document containing the formula errors.
  3. 3. Use formula tools: Navigate to the Formulas tab to access tools like Evaluate Formula or Error Checking to quickly diagnose logical errors.
Fully compatible with Microsoft Excel formats (.xlsx) and standard formulasIncludes a built-in Evaluate Formula feature to step through IF and OR errorsLightweight, fast, and offers a highly familiar user interfaceFree to download and use for all your daily spreadsheet tasks
microsoft office alternative - wps office

Frequently Asked Questions

Why does my IF formula always return false even when the condition seems met?

This usually happens because the data types do not match (e.g., comparing text to numbers) or there are hidden spaces in your cells. Excel evaluates "E1" and "E1 " as entirely different values.

Can I use OR inside an IF statement for multiple conditions?

Yes, you can nest an OR function inside the logical test of an IF function. For example, =IF(OR(A1="Yes", A1="Maybe"), 1, 0) will return 1 if cell A1 contains either 'Yes' or 'Maybe'.

How do I find partial text in a cell using IF?

Since standard IF functions look for exact cell matches, you need to combine IF with ISNUMBER and SEARCH (e.g., =IF(ISNUMBER(SEARCH("text", A1)), true, false)) to find a specific string within a longer cell value.

What is a simpler alternative to long nested IF OR formulas?

If you have many conditions to check, using the IFS function or setting up a reference table to use with the VLOOKUP or XLOOKUP function is much cleaner and easier to maintain.