In this lesson you’re going to learn the main logic functions in spreadsheets.
They help you to get a specified output based on provided tests or 'logical expressions'.
You will often nest other functions within these functions so that your formulas are only executed and data only appears when specific conditions are met.
IF
The IF function is the most commonly used logic function.
It tests a single logical expression and outputs one value if the test is TRUE and another if the test is FALSE.
Syntax
Example
You want to compare two numbers in cells A1 and A2.
If the first is equal to the second you want the output to be "EQUAL".
If the first is not equal to the second you want the output to be "NOT EQUAL".
Nesting
You can also nest IF functions together to test multiple conditions:
If the first logical_expression is FALSE, the nested IF function is executed.
If nesting doesn’t make sense, you can use the IFS function instead:
IFS
The IFS function is similar to IF but it allows you to test more than one logical expression.
It can handle slightly more complex situations than IF.
Syntax
The function is executed from left to right with the value output from the first logic test (or 'condition') that is TRUE.
Example
You want to compare two numbers in cells A1 and A2.
If the first is greater than the second you want the output to be "GREATER".
If the first is equal to the second you want the output to be "EQUAL".
If the first is less than the second you want the output to be "LESS".
When writing your IFS function make sure that all outputs are accounted for otherwise the output will be an #N/A error.
A | B | C | |
1 | First | Last | Sales |
2 | Dwight | Schrute | 10,000 |
3 | Jim | Halpert | 8,000 |
4 | Stanley | Hudson | 7,000 |
5 | Phyllis | Vance | 6,000 |
6 | Andy | Bernard | 4,000 |
7 | |||
8 | Equal: | ||
9 | Better: | ||
10 | IFS: | ||
11 |
FREE RESOURCE
Google Sheets Cheat Sheet
12 exclusive tips to make user-friendly sheets from today:
You'll get updates from me with an easy-to-find "unsubscribe" link.