As part of our series of helping customers with their small business needs Longmont Computer Physicians, LLC is offering these free classes on how to use different software programs. Here is our instructional video on using Microsoft Excel spreadsheets.

Microsoft 365 Beginner class – Excel
Microsoft 365 Intermediate class – Excel
Microsoft 365 Advanced class – Excel


 

The IF function in Excel is one of its logical functions, which evaluate to either a “TRUE” or “FALSE” value. The IF function in Excel lets you perform a logical test on a cell’s value and then return a result based on whether or not the cell’s value passes or fails the test. The IF function is similar to an “If…then…else” coding statement. You must know at least three different arguments to write a logical function. The first argument is the “logical test” to apply to the cell. The second is the cell value or formula to return if the test returns a “TRUE” value or “passes” the logical test. The third is the cell value or formula to return if the test returns a “FALSE” value or “fails” the logical test. The syntax of the IF function is: =IF(logical_test,true_response,false_response) If you want the formula to display a text value for the true response or false response, then you must place the text value inside double quotation marks (“ ”). If you want the function to display a date, it must be enclosed within pound signs (##). The only time you wouldn’t mark the data type of the value to return is if you want the function to display a numerical result or calculate a formula. Often, you may want to know if a cell passes or fails multiple logical tests.

One way to apply multiple logical tests to a cell is to use nested logical functions. A “nested” logical function in Excel is one that places the cell through a second logical test if it “fails” the first. These functions are useful for determining the value of a cell by placing it through several different tests, displaying different results based on which test it passes. You can nest up to 127 additional IF statements behind your original, if needed. The syntax for these are: =IF(logical_test _1,true_response,IF(logical_test_2,true_response,false_response)) You must remember to close all open parentheses for every IF statement you nest within the logical function at the end of the formula. In this case since there are two IF statements, there are two closing parentheses at the end of the formula. Alternatively, if using Excel 2019 or later or using Excel as part of Office 365, you can use the new IFS function to pass a cell though multiple logical tests and return a value for the test it passes. The IFS function replicates the features provided by nested IF functions, but uses a simpler, streamlined syntax. We’ll examine the IFS function in a later lesson.

In addition, you may also want to know if a cell meets multiple criteria at the same time. You can use the AND and OR functions to find this out. The AND function returns a “TRUE” value if the evaluated cell passes all the logical tests listed after the AND function. The OR function returns a true value if the evaluated cell passes any of the logical tests that follow the OR function. Note that you can evaluate up to 255 different logical tests after the AND and OR statements. When you look at how you can combine these tests with the IF function or nested IF functions, you can see how you can start to become a very powerful formula creator. Combining these Excel functions lets you place cells through a battery of tests, and then decide what function to perform or value to display, based on the results from the tests. The general syntax when combining the IF function with the AND and OR functions is as follows: =IF(AND(logical_test_1,logical_test_2,logical_test_3,etc.),true_response,false_response) =IF(OR(logical_test_1,logical_test_2,logical_test_3,etc.),true_response,false_response) The IFS function is only available in Excel 2019 or later or Excel as part of an Office 365 subscription. The IFS function in Excel lets you pass a cell through a series of logical tests and then return a value based on which logical test the cell passes. This provides a very similar functionality to using multiple, nested IF statements. When using Microsoft Office Excel 365.