Excel has no separate IF THEN ELSE function. Instead, the IF function does the whole job in one formula: you give it a test, a value to return when the test is true (the THEN part), and a value to return when it is false (the ELSE part). The basic shape is =IF(test, value_if_true, value_if_false). For example, =IF(A2>=60,"Pass","Fail") returns Pass when the number in A2 is 60 or more and Fail otherwise. Once that pattern is clear, the rest is mainly about nesting several IFs together and keeping them readable with the newer IFS and IFERROR functions. Nothing needs installing; IF has been in every desktop and mobile version of Excel for years, and it works in Excel for the web, Microsoft 365 and in Google Sheets with almost identical syntax.

What You'll Need

  • Excel on Windows, Mac, iPad, iPhone, Android or Excel for the web (or Google Sheets, which behaves the same way)
  • A worksheet with data to test, for example a column of scores, dates, amounts or text values
  • Somewhere to put the formula, ideally in a column labelled for the result so the purpose stays obvious later
  • Basic familiarity with cell references such as A2 and with wrapping text answers in double quotation marks

Step-by-Step

  1. Decide the test. Write down the exact condition you want to check before you touch the formula bar. It must be something that can only be true or false: A2 is greater than 50, B2 equals "Open", C2 is blank, D2 is before today's date. Excel evaluates the test first; if it comes back TRUE you get the THEN value, and if FALSE you get the ELSE value. Nothing else happens.
  2. Put the test in the first argument. Comparison operators are the vocabulary here: >, <, >=, <=, =, and <> meaning not equal. So A2>50 is a valid test on its own. Notice that equality uses a single equals sign inside the formula, not a double one as in some other languages.
  3. Add the THEN value as the second argument. This is what appears when the test passes. If it is text, wrap it in double quotes: "Yes". If it is a number, write it bare: 100. You can also put another formula or another cell reference here, such as B2*1.1 to apply a markup only when a condition holds.
  4. Add the ELSE value as the third argument. This is the fallback for everything that fails the test. A common choice is an empty string written as "" so the cell looks blank, or a short label such as "No". If you leave the third argument out entirely, Excel returns FALSE when the test fails, which usually looks like a bug to anyone reading the sheet.
  5. Close the bracket and press Enter. The completed first example looks like =IF(A2>=60,"Pass","Fail"). Check the result against the source cell by eye before copying anything. If you see the formula text sitting in the cell instead of a result, the cell is formatted as text, and reformatting it to General and re-entering the formula fixes it.
  6. Use the fill handle to copy down. Select the cell, grab the small square in its bottom-right corner, and drag down the column, or double-click that square to fill to the end of the adjacent data. Relative references shift automatically, so row 2 becomes row 3 and so on. If you have a value you do not want to shift, such as a threshold stored in another cell, make it absolute with dollar signs: $F$1.
  7. Nest a second IF for three outcomes. Excel allows an IF formula inside another IF's value arguments. To grade three bands, write =IF(A2>=90,"A",IF(A2>=75,"B","C")). Read it from the outside in: the first test handles the top band; anything that fails falls into the nested test for the middle band; everything else gets the final answer. Each nested level needs its own closing bracket, and the count of opening and closing brackets must match.
  8. Swap deep nesting for IFS when you can. Modern Excel versions include IFS, which reads left to right without the ladder of brackets: =IFS(A2>=90,"A",A2>=75,"B",A2>=60,"C",TRUE,"F"). Each test is followed by its result, and the final TRUE,"F" pair acts as the catch-all ELSE. The catch-all matters: without it IFS returns a #N/A error for anything that matches no test. IFS is not available in Excel 2016 and older, so if the file must open on older copies, stay with nested IF.
  9. Handle errors deliberately. Wrap the IF in IFERROR if the test itself can fail, for example when dividing by a cell that might be zero or looking up a missing value: =IFERROR(IF(B2=0,"n/a",A2/B2),"check input"). The outer function catches errors from the inner calculation and shows a readable message instead of #DIV/0! or #VALUE!.
  10. Test all three branches. Temporarily change a source value so the test fails, then so it passes, then so it hits every nested band. This catches the two most common logic slips: reversed comparison operators and a nested band that can never be reached because an earlier test already catches it.

Common Mistakes

Text answers without quotation marks are the single most frequent error: =IF(A2>50,Yes,No) makes Excel hunt for named ranges called Yes and No and return #NAME?. Ticking a cell with a stray space, as in "Pass ", breaks comparisons and lookups later. Reversed operators are easy to miss in nested formulas, so A2>=90 and A2<90 should never appear in the same chain. Forgetting the catch-all in IFS produces #N/A, and leaving off the third argument of IF produces FALSE. Mixing numbers stored as text with real numbers is another quiet failure: "60" as text is not greater than 60, and Excel treats text as larger than any number in comparisons, so clean the data with Text to Columns, VALUE or TRIM first. Finally, very deep nesting with five or more levels becomes hard to audit, and replacing it with a lookup table and VLOOKUP or XLOOKUP is usually safer than adding a sixth IF.

Tips

Keep thresholds in their own cells and reference them absolutely, so changing a pass mark updates the whole column at once. Use IFS for readability and IFERROR only around calculations that can genuinely fail, not as a blanket hiding tool. To check several conditions at once, put AND or OR inside the test: =IF(AND(A2>=50,B2="Paid"),"Ship","Hold"). For a plain yes or no flag you can also coerce a test directly with double minus, but IF is clearer for anyone else opening the file. Name your result columns, and add a comment on the header cell explaining the logic so the formula survives staff changes. The IF function is case-insensitive for text, so "paid" and "Paid" match; use EXACT inside the test if case must matter.

Troubleshooting

If a cell shows the formula as text, the cell format is Text, or the formula is missing its leading equals sign. If every row returns the same answer, the references are absolute when they should be relative, or the fill handle dragged values instead of formulas. If the result is unexpected for one row, select that cell and use Formulas > Evaluate Formula to step through each part and see which test resolves true. A #NAME? error usually means missing quotes around text or a misspelt function name. A #VALUE! error often means the cell being compared holds text where a number is expected. Wrong answers that look almost right usually come from off-by-one thresholds: A2>90 versus A2>=90 changes the boundary row, so decide whether the cut-off belongs to the band above or below. If the formula is correct but the display is odd, check for hidden leading spaces with TRIM. If nothing works, paste the formula here in a message and rebuild it one argument at a time from the inside out.

Frequently Asked Questions

Is there a real IF THEN ELSE function in Excel?

No. IF is the function, and the true result is the THEN value while the false result is the ELSE value. Many other languages use a separate IF THEN ELSE statement; Excel packs it into one function.

Can I use IF on text instead of numbers?

Yes. Compare against a quoted string such as =IF(B2="Open","In progress","Closed"). The comparison ignores case unless you wrap it in EXACT.

How many IFs can I nest?

Excel allows up to 64 nested levels, but anything past three or four is hard to maintain. Switch to IFS, or to a lookup table with XLOOKUP or VLOOKUP, once the logic grows.

Why does my IF return FALSE instead of my ELSE value?

You left out the third argument. Excel falls back to FALSE when the test fails and no false value is supplied. Add the value, or use "" for a blank result.

Does IF work in Google Sheets the same way?

Yes. The syntax, the quotation rules and the nesting behaviour are the same, and Google Sheets also supports IFS and IFERROR.

Can I test two conditions in one IF?

Yes. Put AND inside the test when both must hold, or OR when either is enough, for example =IF(OR(A2="Urgent",B2>7),"Escalate","Normal").