The IF function would have to be one of the most used and useful functions in Microsoft Excel.
The IF function evaluates a logical test and then returns a specific value if TRUE or another value if FALSE. Let’s break down the IF function and what it consists of and how do we use it.
=IF(Logical Test, Value if True, Value if False)
1. Logical test (required)
2. Value if True (required)
3. Value if False (optional)
The IF function has 3 individual components that make it up.
- The “logical test” component must be included when you use this function. The logical test can consist of any value or expression that results in either a TRUE or a FALSE result when evaluated.
- The “value if true” component must also be included when using this function. This component is the value that you want to be returned when the “logical test” evaluates to TRUE.
- The “value if false” component is entirely optional. This component is the value that you want to be returned when the logical test evaluates to FALSE. If you leave this part of the function out and the “logical test” evaluates to FALSE, the IF function returns the value 0 (zero).
The IF Function in action
See the formula in cell B3 in the image below where we use the IF function to evaluate whether the value in cell A3 is equal to 5 or not.
The formula we have entered into this cell is =IF(A3=5,”Value in A3 = 5″,”Value in A3 does not equal 5″). Breaking down this formula we see:
- the “logical test” is: A3=5
- the “value if true” is: Value in A3=5
- the “value if false” is: Value in A3 does not equal 5
If we enter a 5 into the cell A3 then the result of our formula would equal the “value if true” component, hence Value in A3 = 5.
If we enter any other value into cell A3, the result of our formula would equal the “value if false” component, hence Value in A3 does not equal 5.
Microsoft IF Function example
That’s all there is to get started using this function. Once you go over it a few times, you’ll soon start finding many uses for it in almost every spreadsheet you create.
There are a few more things you can do with this function, like “nesting if functions” (i.e. having an IF function inside another IF function), but we won’t cover that topic today. We’ll save that for another time.
So how do you use the IF function in your spreadsheets? Please share your experiences in the comments below.
If you liked this or know someone who could use it, please feel free to share it with your friends and spread the word on Facebook, Twitter or Linkedin.