Excel IF Statement

When a condition is checked to see if one condition is true and another is false, Excel uses the IF statement. For example, when the temperature is more than 30 degrees Celsius, the formula results in “Wear sunscreen” for sun protection; otherwise, it returns “No need for sunscreen.” The IF function can also be expanded to evaluate multiple conditions thereby creating a nested IF statement for more intricate decision-making scenarios.

Excel IF Statement

= IF (Cell C2 Cell D2, ‘Wear sunscreen”, “No need for sunscreen”)

i.e.

When C2 is 9 and D2 is 7, the result = “Wear sunscreen”

When C 2 is 3 and D2 is 5, the result = “No need for sunscreen”

Excel IF formula

=IF(logical_test, value_if_true, value_if_false)

The Excel function arguments:

Logical test:

In this condition, it is to be tested and evaluated as either TRUE or False.

Value_if_true:

The value is the return when logical_test Evaluate to True.

Value_if_False:

The value is the return when logical_test Evaluate to False.

The logical operators that are used in the IF function;

  • = (equal to): Checks if two values are equal.
  • > (greater than): Evaluate if the left value is greater than the right value.
  • >= (greater than or equal to): Determines if the left value is greater than or equal to the right value.
  • < (less than): Assesses whether the left value is less than the right value.
  • <= (less than or equal to): Checks if the left value is less than or equal to the right value.
  • <> (not equal to): Verifies if two values are not equal to each other.

Simple Excel IF Statement

The IF function evaluates if a certain condition holds, providing one value if the condition is met and another value if it is not.

1. For Example, consider the IF function used in cell B2 as shown below.

Excel IF
-

In this example, the temperature is in column C (Temp), and UV index is in column D (UV). You want to determine whether to wear sunscreen based on these conditions.

The formula in cell E2 (assuming the header row is in row 1) would be:

=IF(C2 > 30, “Wear sunscreen”, “No need for sunscreen”)

This formula checks if the value in cell C2 (temperature) is greater than 30. If it is, it returns “Wear sunscreen”; otherwise, it returns “No need for sunscreen.”

When C2 is 9 and D2 is 7, the formula in E2 would result in “Wear sunscreen” because 9 is less than 30.

When C2 is 3 and D2 is 5, the formula in E3 would result in “No need for sunscreen” because 3 is less than 30.

Feel free to adapt the formula based on your specific Excel layout and dataset.

In this example, the temperature is in column C (Temp), and UV index is in column D (UV). You want to determine whether to wear sunscreen based on these conditions.

The formula in cell E2 (assuming the header row is in row 1) would be:

=IF (C2 > 30, “Wear sunscreen”, “No need for sunscreen”)

This formula checks if the value in cell C2 (temperature) is greater than 30. If it is, it returns “Wear sunscreen”; otherwise, it returns “No need for sunscreen.”

And/Or Use

For the provided examples:

When C2 is 9 and D2 is 7, the formula in E2 would result in “Wear sunscreen” because 9 is less than 30.

When C2 is 3 and D2 is 5, the formula in E3 would result in “No need for sunscreen” because 3 is less than 30.

Feel free to adapt the formula based on your specific Excel layout and dataset.

-

Now, let’s use the IF function in combination with the AND and OR functions in column D to determine the result based on the given conditions:

For the “If this And that” scenario:

In cell D2, enter the formula:

=IF(AND(C2>=60, D2>=90), “Pass”, “Fail”)

Copy this formula down for the rest of the rows.

This formula checks if both Score 1 (C column) is greater than or equal to 60 and Score 2 (D column) is greater than or equal to 90. If both conditions are met, it returns “Pass”; otherwise, it returns “Fail.”

For the “If this Or that” scenario:

In cell D2, enter the formula:

=IF(OR(C2>=60, D2>=60), “Pass”, “Fail”)

Copy this formula down for the rest of the rows.

This formula checks if either Score 1 (C column) is greater than or equal to 60 or Score 2 (D column) is greater than or equal to 60. If at least one of these conditions is met, it returns “Pass”; otherwise, it returns “Fail.”

Now, your dataset will look like this:

-

You can use the IF Excel formula in different situations.