September 15, 2020

# Simple Guide To Using The IF() Function in Google Sheets

###### SECTIONS
1. A Basic Example of IF()
2. An IF() Example That Does Calculations
3. Nesting IF() functions
###### BROWSE TAGS

In this tutorial, we will learn the basics of an important function used in Google Sheets: the IF() function. The IF() function has the general format:

=IF(condition,what_happens_if_true,what_happens_if_false)

Both what_happens_if_true and what_happens_if_false can either display a simple statement or contain a calculation to be done by Google Sheets once the conditions are met. Thus, the IF() function allows for more freedom to the user to program to the spreadsheet what is necessary.

## A Basic Example

Let’s say we want to specify the salary of the employees depending on whether they are full-time or part-time employees. We can set a cell to be a checkbox, and then set another cell to display the corresponding salary. The formula we use is as follows:

=IF(F2=TRUE,"\$4,000/month","\$20.00/hr")

This formula will display the monthly salary of the employees if they are full-time employees or their hourly wage if they are part-time employees. You can see it at work below:

## An Example That Does Calculations

Let us have a more complex example, the one that does calculations inside the IF() function. We want to check if those who are not yet full-time employees are now eligible for full-time salary because they have been working for more than 4 years. We then construct it first as follows:

=IF((YEAR(NOW())-*cell*)>=4,"Eligible for Full-Time","Not Yet")

Then, we fill in *cell* as the cell where the year is located, which is L15 in this case:

## Nesting IF() functions

Sometimes there are cases where we have to have a lot of conditionals. To solve this, we can insert an IF() function inside another one. Let us improve our previous formula by adding a way to display whether the employee is already a full-time employee. We add the following statement:

Then, we insert our previous IF() formula above in the space where *insert-previous-function* is located. The whole formula would look like this: