In this article, we will be looking at how to use the IF ELSE function in Excel. The IF ELSE function is used to test a condition. One value is returned if the condition is TRUE, and another if the condition is FALSE.
This function is most commonly used to automate decision-making processes in spreadsheets. We will explore the 2 ways to use this formula:
Let’s look at these methods thoroughly!
Download the Excel Workbook below to follow along and understand How to Use the IF ELSE Function in Microsoft Excel –
download excel workbookIF-ELSE-function.xlsx
Table of Contents
Single IF
In the example shown below, we have a list of boats and their respective lengths. In order to know whether you need flares, a fire extinguisher, a flashlight, etc. on board, you will need to know the boat’s classification.
To keep things simple, we will introduce 2 boat classifications:
Class A: Less than 16 ft.
Class 1: 16 ft. to less than 26 ft.
The IF function is returned like this:
=IF(test the condition, true result, false result)
In this example, we need to test cells in column B to identify their classification.
The formula we will be using in cell C2 is:
=IF(B2<16,”Class A”,”Class 1”)
This means that if B2 is less than 16 feet, return it with Class A, otherwise, it would be Class 1.
Copy the same formula and apply it the rest of the rows by dragging it down.
Multiple IFs
The previous example can easily classify the boats if there are only two conditions. But what if there are more than two classifications?
This is the complete list of classification for recreational boats in the US:
Class A: Less than 16 ft.
Class 1: 16 ft. to less than 26 ft.
Class 2: 26 ft. to less than 40 ft.
Class 3: 40 ft. to less than 65 ft.
The formula will look like this:
=IF(B2<16,”Class A”,IF(B2<26,”Class 1”,IF(B2<40,”Class 2”,IF(B2<65,”Class 3”))))
Copy the formula from B2 to the rest of the rows by highlighting it and dragging down.
As you can see, once the formula is applied, the boats will automatically be identified in their respective classes.
There you have it! Hopefully, you can utilize this simple, but effective formula in your next project!
John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.