In this tutorial, we are going to cover the following topics.

What is a Logical Function? IF function example Excel Logic functions explained Nested IF functions

What is a Logical Function?

It is a feature that allows us to introduce decision-making when executing formulas and functions. Functions are used to;

Check if a condition is true or false Combine multiple conditions together

What is a condition and why does it matter? A condition is an expression that either evaluates to true or false. The expression could be a function that determines if the value entered in a cell is of numeric or text data type, if a value is greater than, equal to or less than a specified value, etc.

IF Function example

We will work with the home supplies budget from this tutorial. We will use the IF function to determine if an item is expensive or not. We will assume that items with a value greater than 6,000 are expensive. Those that are less than 6,000 are less expensive. The following image shows us the dataset that we will work with.

Put the cursor focus in cell F4 Enter the following formula that uses the IF function

=IF(E4<6000,”Yes”,”No”) HERE,

“=IF(…)” calls the IF functions “E4<6000” is the condition that the IF function evaluates. It checks the value of cell address E4 (subtotal) is less than 6,000 “Yes” this is the value that the function will display if the value of E4 is less than 6,000

“No” this is the value that the function will display if the value of E4 is greater than 6,000

When you are done press the enter key You will get the following results

Excel Logic functions explained

The following table shows all of the logical functions in Excel

Nested IF functions

A nested IF function is an IF function within another IF function. Nested if statements come in handy when we have to work with more than two conditions. Let’s say we want to develop a simple program that checks the day of the week. If the day is Saturday we want to display “party well”, if it’s Sunday we want to display “time to rest”, and if it’s any day from Monday to Friday we want to display, remember to complete your to do list. A nested if function can help us to implement the above example. The following flowchart shows how the nested IF function will be implemented.

The formula for the above flowchart is as follows =IF(B1=”Sunday”,”time to rest”,IF(B1=”Saturday”,”party well”,”to do list”)) HERE,

“=IF(….)” is the main if function “=IF(…,IF(….))” the second IF function is the nested one. It provides further evaluation if the main IF function returned false.

Practical example

Create a new workbook and enter the data as shown below

Enter the following formula

=IF(B1=”Sunday”,”time to rest”,IF(B1=”Saturday”,”party well”,”to do list”))

Enter Saturday in cell address B1 You will get the following results

Download the Excel file used in Tutorial

Summary

Logical functions are used to introduce decision-making when evaluating formulas and functions in Excel.