Excel's IF function lets you test a condition and return one result when it is true and another when it is false, and you can combine several conditions with the IFS function or by nesting IFs. The shortest working pattern is =IF(A2>=70,"Pass","Fail"): the test comes first, the true result second, the false result third. Everything else in this guide is about getting those three pieces right, handling more than two outcomes, and fixing the errors that appear when a comma, a quote or a comparison goes in the wrong place.

What You'll Need

  • A copy of Excel for desktop, Excel for the web, or Excel on mobile. The IF and IFS functions are built in and need no add-ins.
  • A small table of data to practise on, ideally three or four columns with names and numbers.
  • An empty cell for each formula, so you can see the result next to the data you are testing.
  • Basic familiarity with cell references such as A2 and ranges such as A2:A20.

Step-by-Step

  1. Set up the data you want to test. Put the values in named columns and leave the row above for headers. For a grading example, put names in column A, scores in column B, and use column C for the result. Keeping the test values in their own column makes it easy to change one score without editing the formula.
  2. Write a single IF in the result cell. Click the cell where the answer should appear and type =IF(B2>=70,"Pass","Fail"). The first part, B2>=70, is the logical test. The second part is what Excel shows when the test is true. The third is what it shows when the test is false. Press Enter. Excel fills in the answer and displays the formula in the formula bar when you select the cell again.
  3. Use quotes for text and no quotes for numbers. Text results such as "Pass" or "Overdue" must sit inside double quotation marks. Numbers such as 0 or 100 must not. A very common error is typing "Pass" correctly but then writing "70" in a comparison, which turns a number into text and can give a wrong answer.
  4. Copy the formula down the column. Select the corner of the result cell and drag the fill handle down to the last row, or copy the cell and paste it into the range below. Excel adjusts the row references automatically, so B2 becomes B3, B4 and so on. Click a lower cell to confirm the references moved as expected.
  5. Choose the right comparison operator. Use = for equal to, <> for not equal to, > and < for greater and less than, and >= or <= to include the boundary. Decide whether a score of exactly 70 passes before you write the formula, because >70 and >=70 give different answers at that value.
  6. Add a second condition with AND or OR. To require two things at once, wrap them in AND: =IF(AND(B2>=70,C2="Yes"),"Pass","Fail"). To accept either, use OR in the same position. AND and OR return a single true or false, which the outer IF then evaluates. Each condition inside them is separated by a comma.
  7. Handle more than two outcomes with IFS. When you need three or more results, =IF(B2>=90,"A",B2>=80,"B",B2>=70,"C",TRUE,"F") with nested IFs works, but it gets hard to read. The IFS function is cleaner: =IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",TRUE,"F"). Each pair is a test followed by its result, and IFS stops at the first test that is true, so order the tests from strictest to loosest.
  8. Always give IFS a fallback. End the formula with TRUE,"F" or another catch-all. Without it, any value that fails every test returns the #N/A error. In nested IFs the final false argument does this job instead.
  9. Test the edges before you rely on it. Change one value to exactly the boundary, to one below it, and to one above it. Check that blanks and zeros behave sensibly. A blank cell counts as zero in a number comparison, which can quietly mark missing scores as failing.
  10. Lock references you reuse. If the pass mark lives in its own cell, such as F1, write the formula as =IF(B2>=$F$1,"Pass","Fail"). The dollar signs keep the reference fixed when you copy the formula down and across. Change F1 once and every result updates.
  11. Add a readable message for missing data. Wrap the test in a blank check so empty rows do not show a result: =IF(B2="","",IF(B2>=70,"Pass","Fail")). The outer IF returns an empty string for blank input and only runs the grading test when a score exists.
  12. Format and review. Widen the column so results are visible, apply a number format if you return numbers, and use Home > Find & Select to check for leftover errors before sharing the sheet. If formulas show as text instead of calculating, select the cells and confirm the format is General, not Text.

Common Mistakes

The most frequent problem is a misplaced or missing parenthesis. Excel counts every open bracket and needs a matching close, so a formula with two IFs and one AND will fail if a bracket is left out. Click the formula bar and Excel colours the matching brackets as you move through the text.

Another common slip is using commas where the region expects semicolons. Excel separates arguments with the list separator set in your system's regional settings, so a formula copied from a website that uses commas may need semicolons instead. If Excel rejects a formula full of commas, try replacing them.

Text results without quotes also cause errors. Writing =IF(B2>=70,Pass,Fail) makes Excel look for named ranges called Pass and Fail and returns #NAME?. Putting quotes around the wrong thing, such as =IF("B2">=70,...), compares the text characters instead of the cell value.

Nesting too many IFs is a readability trap. Past three or four levels, mistakes hide easily and the formula becomes hard for anyone else to audit. IFS, or a lookup table with VLOOKUP or XLOOKUP, is usually the better choice.

Finally, watch for numbers stored as text. A score imported from another system may look like 85 but be left-aligned in the cell and treated as text, so comparisons give unexpected results. Select the column, use Data > Text to Columns, and finish to convert the values back to numbers.

Tips

  • Keep the pass mark or threshold in a single named cell rather than typing it into every formula. One edit then updates the whole sheet.
  • Use the Evaluate Formula tool on the Formulas tab to step through a long formula and see exactly which part returns true or false.
  • Name your key cells from the Name Box so formulas read like =IF(B2>=PassMark,...) instead of using raw references.
  • Order IFS tests from most to least strict. Because it stops at the first true test, a loose test placed first will capture values meant for a stricter one.
  • Keep a small scratch area with boundary values to test formulas whenever you change a threshold.
  • In Excel for the web and mobile, the formula bar and menu labels can differ slightly from the desktop app, but IF and IFS work the same way.

Troubleshooting

If you see #NAME?, Excel does not recognise something in the formula. Check for missing quotes around text, a misspelled function such as IFSS, or a function name written in a language other than the one Excel expects.

If you see #N/A from IFS, no test matched. Add a final catch-all pair such as TRUE,"Other", or check that your ranges cover every possible value.

If you see #VALUE!, a comparison is mixing text and numbers. Confirm the tested cell holds a real number and that any text results are in quotes.

If the answer is wrong but there is no error, check the operator first: > versus >= at the boundary is the usual culprit. Then check for stray spaces in text values; "Pass " with a trailing space will not equal "Pass". Use TRIM on imported data to remove them.

If the formula will not calculate, the cell may be formatted as Text, or calculation may be set to Manual. Change the format to General and re-enter the formula, and check the calculation options on the Formulas tab.

Frequently Asked Questions

What is the difference between IF and IFS?

IF returns one of two results: true or false. IFS returns one result from a list of test-and-result pairs, stopping at the first test that is true. Use IFS when you have three or more possible outcomes.

Can I use more than one condition in a single IF?

Yes. Put AND inside the test to require every condition, or OR to accept any one of them, as in =IF(AND(A2>0,B2<100),"OK","Check").

Why does my IF formula return 0 instead of a blank?

A blank cell is treated as zero in numeric comparisons. Add a blank check such as IF(B2="","",...) so empty rows show nothing.

Does IFS work in older versions of Excel?

IFS was added in later versions of Excel, so very old files may not recognise it. Nested IFs work in every version and do the same job.

How many IF statements can I nest?

Excel allows a limited number of nested levels that varies by version, but you should rarely approach it. Switch to IFS or a lookup table well before the limit.

Can IF return a formula instead of a value?

Yes. Each result can be a calculation, such as =IF(B2>=70,B2*1.1,B2), and Excel evaluates only the branch that matches.