How to Use the If Function in Google Sheets
By [email protected] (Martina Bretous)
One of the most valuable functions in Google Sheets is the “IF” functions.
Imagine you want to be able to quickly scan your spreadsheet and answer some key questions. This function will help you do that.
Let’s jump into how it works and see some real-life examples.
What does the if function do in Google Sheets?
In Google Sheets, the if function allows you to check a condition and return a specific value if it’s TRUE.
For instance, say you have three columns in a spreadsheet: channel, target, and profit. You want to know which channels hit a profit higher than the target.
You can use the IF function to do so – the formula logic would look like this: If the target is higher than the profit, it will return “YES.” If not, it will return a “NO.” You can then track that data in another column titled “Goal Met.”
How to Use If Function in Google Sheets
When using the if function in Google Sheets, you must use the following syntax:
IF(logical_expression, value_if_true,value_if_false)
Let’s break down what each one means:
- Logical expression refers to the condition you’re checking in the function.
- Value if true is the value the function will return if the logical expression is true.
- Value if false is the value the function will return if the logical expression is false.
To do this, you’ll need to use the following logical expression symbols:
- > to denote greater than
- >= to denote equal or greater than
- < to denote greater than
- <= to denote equal or less than
- to denote not equal
- = to denote equal
Let’s see a real-life example.
Here, we have a spreadsheet with data on how each marketing channel performed. Each channel had a target revenue next to the actual profit. The last column, “goal reached” will be used to quickly answer which channels met the goal.
-
Select the cell in which the formula will be applied.
-
Write out the formula following this syntax:
-
Drag the mouse to apply the formula to relevant cells.
Scared you’ll forget it? Don’t worry. Google Sheets has an autofill feature that will show you the formula as you type it out.
In this case, the formula will be: =if (C2 > B2, “YES” , “NO”). To break that down further, the …read more
Source:: HubSpot Blog