IF Function in Excel: Syntax, Examples and Free Practice
IF is an Excel Logic function. Returns one value if a condition is true, another if false.
IF syntax
Arguments
logical_test: The condition to check, e.g. B2>=40value_if_true: Result if truevalue_if_false: Result if false
When to use IF
Flagging an employee as Pass or Fail based on a score cutoff.
Practice IF online, free
Solve graded IF practice questions in a live Excel-style spreadsheet and check your answer instantly.
Practice IF now →Watch: IF in Excel
Learn more
Read the tutorial: IF with AND / OR.
IF practice questions
- Using IF, show Pass if the marks are 40 or more, otherwise Fail. Fill C2 to C4.
- Show Reorder when the stock is below 20 and OK otherwise. Fill C2 to C4.
- Using IF, give a 5% bonus on sales above 50000 and 0 otherwise. Fill C2 and C3.
- A candidate is Eligible only if the age is 18 or above and the score is 60 or above.…
- Using IF with OR, show Free if the order is 1000 or more or the customer is a member,…
- A blank Days cell means the order is not delivered yet. Show Done if Days has a value…
- Using nested IF, assign grades: 90 and above is A, 75 to 89 is B, 50 to 74 is C, below…
- Using nested IF with these simplified slabs, find the tax: nothing up to 250000; 5% of…
- Compare the year's total sales with the target in E2. If the target is met show Target…
- Discount rules: 20% if quantity is 100 or more and the customer is Gold; 10% if only one…
- The pass mark is 40. Scores are in B2:B7. Show Pass or Fail for each student in D2:D7.
- Sales are in B2:B6 and targets in C2:C6. Pay 5% of sales as commission when sales reach…
- Income is in B2:B6. Tax is 0 up to 250000; 5% on the part above 250000 up to 500000; and…
More Logic functions
Frequently asked questions
What does the IF function do in Excel?
Returns one value if a condition is true, another if false.
What is the syntax of IF in Excel?
The syntax is =IF(logical_test, value_if_true, value_if_false). logical_test: The condition to check, e.g. B2>=40; value_if_true: Result if true; value_if_false: Result if false.
Where can I practice IF online for free?
Open the free live spreadsheet on Cellgrids and try IF yourself. No Excel install is needed and you can start without signing up.
All Excel formulas · Cheat sheet · Excel exercises · Logic functions · Excel case studies · Excel tutorials · Excel shortcuts