Excel’s IF function chooses between two results after checking a condition. You can use it to label a mark, flag a low stock quantity or check whether a target has been reached. This beginner exercise starts with a small results sheet.
All names and marks below are invented. We will use 50 as the pass mark for this exercise only; it is not an official examination rule.
1. Create this practice table
Open a blank worksheet. Enter Student in A1, Marks in B1 and Result in C1. Type the following five records in rows 2 through 6. Leave Bilal’s mark empty.
| Row | A: Student | B: Marks | C: Expected result |
|---|---|---|---|
| 2 | Ali | 78 | Pass |
| 3 | Sara | 45 | Fail |
| 4 | Usman | 50 | Pass |
| 5 | Ayesha | 92 | Pass |
| 6 | Bilal | Leave empty | Leave empty after step 3 |
2. Enter the basic IF formula
Select C2 and enter:
=IF(B2>=50,"Pass","Fail")
Press Enter. Ali’s result should be Pass. Copy the formula down to C5 using the small fill handle at the lower-right corner of the selected cell.
The test B2>=50 asks whether the mark is at least 50. A true result returns Pass; a false result returns Fail. Text results need quotation marks. The general structure is =IF(test,result_if_true,result_if_false). Source: Microsoft IF documentation.
3. Keep an unfinished result empty
The basic formula would label Bilal’s empty mark Fail. For this practice sheet, we want an unfinished record to stay blank. Replace C2 with:
=IF(B2="","",IF(B2>=50,"Pass","Fail"))
Copy it down through C6. The first check handles an empty mark; the second applies our practice threshold. Bilal’s result should now be empty. This assumes marks are valid numbers from 0 to 100 or empty cells.
4. Test the boundary yourself
Change Usman’s mark from 50 to 49. His result should change to Fail. Restore 50 and confirm Pass. Next, enter 67 for Bilal and check that his result becomes Pass. Clear his mark again: the result should disappear.
Testing values just above and below a rule helps you catch a common mistake: >50 would exclude 50, while >=50 includes it.
5. Fix common entry problems
- Start the formula with an equals sign.
- Use straight quotation marks around Pass and Fail.
- Enter marks as numbers, without extra words or spaces.
- If your Excel setup requires semicolons as separators, use the version below.
=IF(B2="";"";IF(B2>=50;"Pass";"Fail"))
Formula separators depend on your regional and Excel settings. If a cell displays the formula as text, check that its format is General, then enter the formula again. Source: Microsoft formula troubleshooting.
Your next practice task
On a separate sheet, create Item, Quantity and Status columns. Invent three quantities and use =IF(B2<=5,"Reorder","Enough") in C2. This exercise uses five as an invented reorder threshold. Try quantities of 4, 5 and 6, then explain why the first two return Reorder.
Explore more Computer Education lessons, or continue with EagleHut’s XLOOKUP guide.