Understanding If /Then Statements in Google Sheets
If/Then statements are often considered complex. But in reality, they’re not at all difficult to pull off. Plus, they can be more useful than you realize when working with specific data sets or expressions in a spreadsheet.
If you have a background in Microsoft Excel, this shouldn’t be anything new to you. However, if you’re new to working with spreadsheets then the following information should prove valuable.
Google Sheets is a part of Google’s free suite of products that allow users to share, create, and maintain important information.
Understanding Functions in Google Sheets
If you’re not familiar with spreadsheets, the If/Then statements may not make much sense at first. Functions are basically a way to calculate the data in your spreadsheet. Whether it’s something as simple as the ‘SUM’ function which adds numbers for you or something more complex, there are a few rules to using the predetermined functions in Google Sheets.
In order for a function to work properly, you will have to properly order the function in your cells to get it to work. For example, start the function with the “=” symbol, then use the function name, and lastly, the argument.
The argument is the cell range you’re working with. A function should look something like this: “=SUM(A1: A5).”
Aside from IF/Then statements in Google Sheets, there are several functions available for users to better interact with and better organize their spreadsheets. From calculating ages and dates to using conditional formatting which automatically changes the colors of certain values, Google Sheets offers so many customization options it’s a great tool for any user.
To find other functions you can click on ‘Insert’ at the top of your spreadsheet and click on ‘Functions.’ A menu will pop-up with all of the possible pre-loaded functions available.
You can visit the Google Sheets support page for a list and search option of what each function does and how to use it.
IF Then Statement
The If/Then statement is a statement of the IF function that’s used to trigger a specific action when a certain condition is met after evaluation or a logical test. At the same time, if the condition isn’t met then the function will return the “FALSE” result. Essentially, you tell Google Sheets if something is true it needs to do one thing, but if it’s false Google Sheets needs to do something else.
For example, you can use this statement to see how certain numbers compare to each other in two separate columns. You can use the function to evaluate if the numbers are equal to each other or if one is greater than the other.
Based on this example, here’s how you can use the If/Then function:
- Type =IF(B3=C3, “match”) in the G3 cell.
- Type =IF(B4=C4, “match”) in the G4 cell.
- Type =IF(B5>C5, B5&” is greater than “&C5) in the G5 cell.
- Type =IF(B6>C6, B6&” is greater than “&C6) in the G6 cell.
The result should look like this:
The function returns the “match” result because the numbers in B3 and C3 are equal. Therefore G3 returns a match. However, G4 returns a “false” result. The reason for this is because the function wasn’t given a specific action for the event in which the condition in the formula wasn’t met.
You can set a specific action for when the condition isn’t met. For example:
- Type =IF(B3=C3, “match”,”no match”) in the F3 cell.
- Type =IF(B3=C3, “match”,”no match”) in the F4 cell.
The results will then display differently from the previous function parameters.
If Function Arguments
As you can see, the IF function basically has three arguments. It can be used to test a value or statement in a particular cell. It can then indicate what happens based on the result of that test and if the statement is either true or false.
It’s one of the basic and most commonly used logical functions in Google Sheets and works in the exact same way as the IF function in Microsoft Excel, the OpenOffice calculator, iNumbers, and other similar programs.
It has a variety of applications, depending on how you’re looking to analyze certain data sets in a spreadsheet. It’s one of the first functions you can easily learn and apply to a worksheet. Doing so makes it easier to then delve into more complex functions.
Type It or Insert It
You can always type the function of choice in a cell to apply the function, based on the set parameters, to that specific column. However, you can also insert the function from the Insert menu.
- Go to Insert.
- Go to Function.
- Go to the Logical option.
- Click on the IF function from the list.
You’ll notice that there are many other functions listed there as well. The cool thing about adding the function via the Insert tab is that you’ll also get a brief explanation and an example of how to set the parameters for the logical expression.
As previously mentioned, the IF function is very basic, and usually used to display one of two potential outcomes. However, the function can also be modified into a nested IF statement. This implies running an additional test, or two, within the function in order to reach a third potential outcome.
It’s also important to remember to always use quotation marks when inputting parameters and outcomes, whether you’re comparing numbers or words. And yes, the function can also be used on words too, not just numbers.
IF/Then Is a Logical Foundation to Advanced Spreadsheet Work
Although it’s one of the most basic functions, the IF function and the If/Then statements are very important to learn early on. These serve as great introductory elements into spreadsheet functions, how to find them, how to write them, and how to use them to your advantage.
It may take some time, but learning how to use the various features of Google Sheets will help you immensely. Whether it’s getting a new job or running a business more smoothly, it’s important to stay up-to-date with your knowledge of spreadsheet software.