Excel IF Function

The Excel IF function is among the most used Excel functions. This is because it is simple and easy to use. This function is a logical function and allows a user to specify certain results based on whether or not a certain criterion has been met.

Formula

The generic syntax for Excel IF function is:

=IF(logical_test, [value_if_true, [value_if_false)

It has three arguments:

logical_test – A logical expression that is evaluated as TRUE or FALSE.

value_if_true – [optional] The value to return when logical_test evaluates to TRUE.

value_if_false – [optional] The value to return when logical_test evaluates to FALSE.

Explanation

While using this logical function, you expect either a “TRUE” or “FALSE” based on your set criteria. Think of a situation where you want to state something like:

“If this is true, then this, otherwise something else”

While this function might seem simple and straightforward, its significance as a logical function makes it the one of the most used Excel functions. Let’s look at the how the Excel IF function is used.

Example

Below is a list of names for students in a certain school. We shall run a test to see those who have passed 50% and those who haven’t. For those with a score of 50% and above, we shall have the result as “PASS” while those with 49% and below shall return “FAIL.”

Figure 1: Using Excel IF function to check those who have PASSED/FAILED

We now need to show the result in column C as either “PASS” or “FAIL” to show those who got 50% and above as “PASS” and those with 49% and below as “FAIL”.

The syntax of the formula is as below:

=IF(B2>50, “PASS”, “FAIL”)

Our first result shall be in the cell C2, and shall be done as below:

Figure 2: Specifying cell B2 with the IF function

After specifying the formula in cell C2, we get the result for B2. Press “Enter” to get the result for the cell B2 in cell C2. Hold and drag to get results for other cells.

After getting the result for cell B2 in cell C2, click on cell C2, hold the cursor down and drag it across all the other cells. This will give you the result as shown in the diagram below:

Figure 3: Hold and drag to get results of IF function in other cells

Nested IF function

What happens when you want to test many conditions are getting various results? In such a case one can use multiple nested IF functions.

A nested IF function is used when you need to use more than one IF function while carrying out various tests to come up with various results.

Example

Let us assume that we now want to grade the students, based on the marks they get. The IF function shall be grouped so that we get the grade for each student as done below:

=IF(B2>=70,"A",IF(B2>=60,"B",IF(B2>=50,"C",IF(B2>=40,"D"))))

Figure 4. Using IF function to get grade result

After entering the nested IF function in a cell, the next step is to point the cursor on the bottom-right corner of the cell and drag it down across all the other cells. This will automatically grade all the other students in our list.

The final result will look like the one below:

Figure 5. The final result of students

In conclusion, using the IF function and nested IF functions in Excel are very important. With this function, you are able to easily and quickly grade as well as show whether individuals qualify based on given criteria.

“The expert was absolutely amazing and stuck with me the whole way through. They were polite, patient, seemed to want to genuinely help me and provided a solution that I would never have managed otherwise. I could not be more thankful for their support and solution. Thank you!”
- - Chris T, in California

Leave a Comment

This comment form is under antispam protection

This comment form is under antispam protection

Subscribe to Excelchat.co

Get updates on helpful Excel topics

Trusted by people who work at

Plans & Pricing

I’ll use as many sessions as I want per month

$29.99

/month

Unlimited Sessions

Best offer

I want the unlimited sessions for 3 months AND save money

$74.99

/ 3 months

Unlimited Sessions for 3 months

Save $15 when you buy a subscription for 3 months

I want the unlimited sessions subscription AND save over a hundred dollars