The IF function returns one of two values in a cell based on a true or false answer to a logical
Tests a given condition and returns one value for a TRUE result, and another for a FALSE result Show
What is an Excel IF Statement?The Excel IF Statement tests a given condition and returns one value for a TRUE result and another value for a FALSE result. For example, if sales total more than $5,000, then return a “Yes” for Bonus – Otherwise, return a “No” for Bonus. We can also use the IF function to evaluate a single function, or we can include several IF functions in one formula. Multiple IF statements in Excel are known as nested IF statements. As a financial analyst, the IF function is used often to evaluate and analyze data by evaluating specific conditions. The function can be used to evaluate text, values, and even errors. It is not limited to only checking if one thing is equal to another and returning a single result. We can also use mathematical operators and perform additional calculations, depending on our criteria. We can also nest multiple IF functions together to perform multiple comparisons. IF Formula=IF(logical_test, value_if_true, value_if_false) The function uses the following arguments:
When using the IF function to construct a test, we can use the following logical operators:
How to use the Excel IF FunctionTo understand the uses of the Excel IF statement function, let’s consider a few examples: Example 1 – Simple Excel IF StatementSuppose we wish to do a very simple test. We want to test if the value in cell C2 is greater than or equal to the value in cell D2. If the argument is true, then we want to return some text stating “Yes it is”, and if it’s not true, then we want to display “No it isn’t”. You can see exactly how the Excel IF statement works in the simple example below. Result when true: Result when false: Download the simple XLS template. Example 2 – Excel IF StatementSuppose we wish to test a cell and ensure that an action is taken if the cell is not blank. We are given the data below: In the worksheet above, we listed AGM-related tasks in Column A. Remarks contain the date of completion. In Column B, we will use a formula to check if the cells in Column C are empty or not. If a cell is blank, the formula will assign the status “open.” However, if a cell contains a date, then the formula will assign a status of “closed.” The formula used is: We get the results below: Example 3 – Excel IF StatementSellers frequently provide a discount based on the quantity purchased. Suppose we are given the following data: Using multiple IF functions, we can create a formula to check multiple conditions and perform different calculations depending on what amount range the specified quantity falls in. To calculate the total price for 100 items, the formula will be: We get the result below: Things to remember about the IF Function
Reasons to use an Excel IF StatementThere are many reasons why an analyst or anyone who uses Excel would want to build IF formulas. Common examples include:
Click here to download the sample Excel file Additional resourcesThanks for reading CFI’s guide on how to use an Excel IF Statement. By taking the time to learn and master these functions, you’ll significantly speed up your financial analysis. To learn more, check out these additional CFI resources:
Does IF function Show True or false?Syntax. Use the IF function, one of the logical functions, to return one value if a condition is true and another value if it's false.
Does IF function can have two results?The IF function allows you to make a logical comparison between a value and what you expect by testing for a condition and returning a result if True or False. So an IF statement can have two results. The first result is if your comparison is True, the second if your comparison is False.
How do you write two logical tests in an IF function?When you combine each one of them with an IF statement, they read like this: AND – =IF(AND(Something is True, Something else is True), Value if True, Value if False) OR – =IF(OR(Something is True, Something else is True), Value if True, Value if False) NOT – =IF(NOT(Something is True), Value if True, Value if False)
Can IF function return a cell value?The IF() function has an important place amongst the most popular functions in Excel. It performs a simple logical test (is a statement TRUE or FALSE?) and, depending on the comparison result, returns one value if a result is a TRUE, or another value if a result is FALSE.
|