Share this article:

The IF formula is what you’ll use to create an IF-THEN statement. Part of constructing the IF formula includes the “THEN” part of your equation. The IF function is a versatile logical function in Excel. It evaluates a condition (logical_test) and then performs an action based on whether the condition is TRUE or FALSE. The basic syntax of the IF function is:

=IF(logical_test, value_if_true, value_if_false)

  • logical_test: The condition that you want to test.
  • value_if_true: The action to perform if the condition is TRUE.
  • value_if_false: The action to perform if the condition is FALSE.

Example 1:

Suppose you have a list of students and their test scores, and you want to assign a pass or fail grade based on whether the score is above or below 50.

StudentScore
John65
Mary45
Peter52

In this case, the IF formula could be =IF(B2>=50, "Pass", "Fail"). If the score in B2 is greater than or equal to 50, “Pass” will be returned; otherwise, “Fail” will be returned.

Example 2:

Consider a situation where you have a list of products and their quantities in stock, and you want to know if you need to reorder.

ProductQuantity
Apples30
Oranges55
Grapes15

The formula could be =IF(B2<=20, "Reorder", "Sufficient"). If the quantity in B2 is less than or equal to 20, “Reorder” will be returned; otherwise, “Sufficient” will be returned.

Example 3:

Imagine a list of sales reps and their sales amounts. You want to give a bonus to anyone who sold over $5000.

RepSales
Amy5300
Bob4800
Charlie6000

The formula could be =IF(B2>5000, "Bonus", "No Bonus"). If the sales in B2 are greater than 5000, “Bonus” will be returned; otherwise, “No Bonus” will be returned.