Explanation of the IF statement
The IF statement has 3 arguments as shown below:
Understanding how to use the IF statement is important because it’s one of the most basic functions yet incredibly useful and powerful.
Note: You can even use other functions within your IF statement (in any of the 3 arguments).
The logical_test is a logical evaluation and must contain a logical operator. You can provide logical evaluations such as:
- A mathematical calculation and evaluate if it equals a specific number, or if it is greater than or less than a specific number
- Checking to see if a cell equals a specific text value (string)
- Using a function within your logical_test
This is what you want Excel to do if the result of your logical_test is TRUE. Some examples would be:
- Write a vlookup to bring a value from somewhere
- Use any Excel function or combination of functions to evaluate for a result
- Open another IF statement (embedded IF statements)
- Perform a mathematical calculation
- Return a fixed result (number or text)
- Return a blank value by using 2 quotations side by side “”
This is what you want Excel to do if the result of your logical_test is FALSE. You can use all the same examples as listed above in the [value_if_true] section.
Examples of the IF statement
If the day of the week is Monday, return “yes” or else “no.
If the day of the week is a Weekday (Monday to Friday) then put “Weekday” or else put “Weekend”.
How this formula works is IF the 1st character from the left is an “S”, then put “Weekend” or else “Weekday”.
If I wrote RIGHT(B3,3)=”day” and copied this formula in all of my rows the result would be TRUE for all rows. This would be evaluating if the last 3 characters from the right equal “day”.
Go back to Excel Tutorials.