Use the IF function to check a cell and return one value if true and another if false. The basic syntax is IF(logical_test, value_if_true, value_if_false). If you need to choose between more than two options, use nested IFS or the CHOOSE function. Both functions are built into all modern versions of Excel and require no add-ins.

What You'll Need

  • A computer with Microsoft Excel installed (2010 or newer is recommended).
  • The spreadsheet containing the data you want to evaluate.
  • A specific cell where you want the result of the "this or that" logic to appear.
  • A clear understanding of the three possible outcomes for your condition: the "Yes/True" result, the "No/False" result, and, if necessary, the "Maybe/Both" result.

Step-by-Step

  1. Identify your criteria. Look at your data and determine exactly what makes a cell fall into category "A" versus category "B". For example, if you have a column of sales figures, your criteria might be "Sales greater than 500" versus "Sales less than 500". Write this condition down in plain English first to ensure accuracy.
  2. Open the formula bar. Click on the empty cell where you want the result of the "this or that" logic to display. Click inside the formula bar at the top of the Excel window. This is where you will type your function.
  3. Start the IF function. Type the equals sign = followed by the word IF. Excel will usually suggest the function name; you can either type it or select it from the dropdown list that appears.
  4. Enter the logical test. Inside the parentheses, type your condition. This must be a statement that Excel can evaluate as either TRUE or FALSE. If your condition involves text, enclose it in quotation marks (e.g., A2="Yes"). If it involves numbers, do not use quotes (e.g., B2>100). Press Tab or click into the next argument field to move to the next part of the formula.
  5. Define the value if true. This is the result you want Excel to display if the logical test evaluates to TRUE. This can be a number, text, or another cell reference. For example, type "Approved" or C2. Press Tab or click into the next argument field.
  6. Define the value if false. This is the result you want Excel to display if the logical test evaluates to FALSE. This is the "other" option in your "this or that" scenario. For example, type "Pending" or 0. Once you have typed this, close the parentheses ) and press Enter.
  7. Copy the formula down. With the result visible in the first cell, click on the small square in the bottom-right corner of the cell (the fill handle). Drag it down to apply the same "this or that" logic to the rest of your column. Excel will automatically adjust the cell references (e.g., A2 becomes A3, B2 becomes B3) for each row.

Common Mistakes

A common error is forgetting to include the logical test in quotation marks when it involves text. Excel treats "Sales > 500" as text, not a mathematical comparison, resulting in a #VALUE! error. Always double-check that your logical test is a statement that evaluates to TRUE or FALSE, not a statement that results in a number or text string.

Another frequent mistake is failing to close all parentheses. Excel requires an opening parenthesis for every closing one. If you miss one, the formula will return a #NAME? error. The easiest way to avoid this is to type the opening (, then type the three arguments, and finally type the closing ). The cursor will usually jump to the correct position.

Tips

Use the IFS function for situations where you have multiple "this or that" scenarios rather than a simple binary choice. The syntax is IFS(condition1, value_if_true1, condition2, value_if_true2, ...). This is often cleaner than nesting multiple IF statements inside one another.

To make your formulas easier to read and debug, use line breaks. Press Alt + Enter inside a formula to break it into multiple lines. This allows you to see the logical test, the value if true, and the value if false clearly aligned, making it much easier to spot where a mistake might be hiding.

Troubleshooting

If the formula returns a #VALUE! error, check your logical test. Ensure that you are not comparing text to numbers (e.g., comparing a number in cell A2 to the text string "100"). Excel cannot perform mathematical operations on text. If you want to compare text to text, enclose the text in quotation marks.

If the formula returns the wrong result, check your cell references. If you copied the formula down, did the reference change correctly? If you used absolute references (e.g., $A$2), the reference will not change. This is useful for checking a single value against a list, but not for checking a list of values against a single value.

If the formula returns FALSE when you expect TRUE, check your logical test. Ensure that your operators are correct. For example, use > for greater than, < for less than, and >= for greater than or equal to. A common mistake is using a single equals sign = instead of a comparison operator, which equates the two values rather than checking them.

Frequently Asked Questions

Can I use the IF function to check if a cell is empty?

Yes, you can use the logical test ISBLANK(cell_reference). For example, IF(ISBLANK(A2), "Empty", "Not Empty") will return "Empty" if the cell is blank and "Not Empty" if it contains any data.

How do I make the IF function case-sensitive?

The standard IF function is not case-sensitive. To check for specific letter casing, you must use the EXACT function. The logical test would be EXACT(A2, "Yes"). This will return TRUE only if the text in A2 is exactly "Yes" with the same capitalization.

What is the difference between IF and IFS?

The IF function checks one condition and returns a result based on whether it is true or false. The IFS function checks multiple conditions in sequence and returns the result corresponding to the first condition that is true. It is useful for a "this or that or that" scenario.

Why does my formula show the formula text instead of the result?

This usually happens if the cell is formatted as Text before you type the formula. Change the cell format to General, then retype the formula. Alternatively, you can press Ctrl + ` (the backtick key) to toggle formula viewing on and off to see if the cell actually contains the formula.

Can I nest IF statements inside one another?

Yes, you can nest IF statements to create more complex "this or that" logic. For example, IF(A2>100, "High", IF(A2>50, "Medium", "Low")). However, for very complex logic, using the CHOOSE function or the IFS function is often easier to read and maintain.