Logical Functions in Excel

This chapter teaches you how to use logical functions in Excel such as the IF function, AND function and OR function. The IF function can be nested, when you have multiple conditions to meet. To keep it as simple as possible, we will use easy examples.

If Function

The IF function checks whether a condition is met, and returns one value if TRUE and another value if FALSE. You can download the accompanied Excel file if you want.

1. Select cell D2, type in, =IF(A2>2,"That's Correct", "Not Correct")

Tip: instead of typing A2, while typing, simply select cell A2.

Result:

If Function

Note: instead of "That's Correct" and "Not Correct", you can use any names!

AND Function

The AND Function checks whether all arguments are TRUE, and returns one value if all arguments are TRUE, and returns another value if any of the arguments are FALSE.

1. Select cell E2, type in, =IF(AND(A2>2,B2>2),"That's Correct", "Not Correct")

Tip: instead of typing in A2 and B2, while typing, simply select cell A2 and cell B2.

Result:

And Function

The IF function returns "Not Correct", because value b is not higher than 2.

Note: the AND function has two arguments in this example, but you can check up to 255 arguments in Excel!

Or Function

The OR function checks whether any of the arguments are TRUE, and returns one value if any of the arguments are TRUE, and returns another value if all arguments are FALSE.

1. Select cell F2, type in, =IF(OR(A2>2,B2>2),"That's Correct", "Not Correct")

Tip: instead of typing in A2 and B2, while typing, simply select cell A2 and cell B2.

Result:

Or Function

The IF function returns "That's Correct", because value a is higher than 2.

Note: the OR function has two arguments in this example, but you can check up to 255 arguments in Excel!

Nested If

The IF function can be nested, when you have multiple conditions to meet. The FALSE value is being replaced by another If function, to make a further test.

1. Select cell G2, type in, =IF(C2=1,"Bad",IF(C2=5,"Good",IF(C2=10,"Excellent", "Not valid")))

Tip: instead of typing in C2 three times, while typing, simply select cell C2.

Result:

Nested If

If cell C2 equals 1, the function returns Bad.
If cell C2 equals 5, the function returns Good.
If cell C2 equals 10, the function returns Excellent.
If cell C2 equals another value, the function returns Not valid.

Did you like this free Excel tutorial? Show your appreciation, vote for us.

1. Show your appreciation, vote for us

Thank you very much! We've got many more free Excel tutorials for you. Read on, learn, and enjoy!

2. Learn more
 

Go to Top: Logical Functions in Excel    |    Go to Next Tutorial: Date & Time Functions

  • Follow us