Summary

The IF function returns different values depending on whether a condition is true or false. Use it in the form =IF(Condition,True,False). For example, =IF(C2>=60,“Pass”,“Fail”) will return “Pass” if the value in C2 is equal to or over 60 and “Fail” if the value is under 60.

Whether you’re grading exams or simply trying to make sense of a spreadsheet full of data, Microsoft Excel’sIFfunction can help. you’re able to also use anIFfunction inside of anotherIFfunction to run deeper tests, too. We’ll show you how.

Choose a cell.

What Can You Do with Excel’s IF Function?

Put simply, you’re able to use theIFfunction to retrieve a pre-specified result based on whether the function gets a TRUE or FALSE value.

For example, if you have a score sheet, you may make it so your cells say

Result of Excel’s IF function.

if someone has scored 60 or higher, or say

if the score is 59 or lower. you may use a nestedIFto even assign grades, like an

Result of Excel’s IF function for all records.

for someone with a score of 90 or higher.

How to Write an IF Statement in Excel

To write anIFstatement in Excel, all you have to do is type the function and specifywhat results to retrieve when the conditionis TRUE and FALSE.

Related:How to Use Conditional Formatting to Find Duplicate Data in Excel

Dataset for Excel’s nested IF function.

Start by launching your spreadsheet with Microsoft Excel. Then, click the cell in which you want to use the function.

In the following example, we’ll use theIFfunction to say

Result of Excel’s nested IF function.

if the obtained score is 60 or higher and

if the score is 59 or lower.

Result of Excel’s nested IF function for all records.

We’ll select the D2 cell where we want to display the result.

In the D2 cell, we’ll enter the following function and press Enter.

In the selected cell, you’ll see the result depending on the value in the C2 cell.

To copy the function for all your records, from the bottom-right corner of the D2 cell, drag downwards to cover all your records.

And that’s it.

Modify theIFfunction in whatever way you want and you’ll get the desired result.

Use the Nested IF Function in Excel

A nestedIFis anIFfunction inside of anotherIFfunction. You use this when you want to run another logical test after the first one.

We’ll use the following dataset to demonstrate this function:

In this dataset, depending on the scores, the following results will be displayed:

We’ll select the D2 cell where we want to display the result, and then enter the following nestedIFfunction and press Enter:

You’ll see the result in your selected cell.

You can copy the function for all your records by dragging downwards from the D2 cell’s bottom-right corner.

And you’re set.

Excel’sIFfunction is an excellent way to run various logical tests. you may use it to specify multiple conditions and display the results accordingly.

While you’re at it, check out otherExcel logical functionsthat can be useful in your work.

Basic·Budgeting·Data Entry·Logical·Text·Time and Date

Explained

Copying Formulas·Evaluating Formulas·Finding Functions·Fixing Formula Errors·Functions vs Formulas·Comparing Lookup Functions·Locking Formulas·Structuring Formulas·Translating Formulas