Skip to Content

How to Use Vlookup with if Statement in Google Sheets (Conditional Vlookup)

When working with large sets of data, searching for specific entries can be challenging. Thankfully, Google Sheets provides a powerful tool called the VLOOKUP formula that helps us tackle these difficult tasks.

VLOOKUP stands for vertical lookup. It allows us to retrieve data by searching for keys in a specific column. Typically, the key is found in the first column of a table, and it helps us locate the desired data in the corresponding row.

However, the VLOOKUP function has its limitations when it comes to retrieving data. In this guide, we will show you how to go beyond the basic functionality of the VLOOKUP formula. 

Today’s tutorial will show you how to use VLOOKUP with IF statement in Google Sheets. This combination allows us to perform more advanced operations and overcome the limitations of VLOOKUP alone.

Use case/scenario for leveraging Vlookup with if statement in Google Sheets 

Imagine you are a teacher managing a student database in Google Sheets. You have a sheet containing student information, such as their names, grades, and attendance records. You want to find out which students have achieved a specific grade and have attended a certain number of classes.

In this scenario, the VLOOKUP function alone wouldn’t be sufficient. However, by combining Vlookup with IF statement in Google Sheets, you can create a more advanced formula. You can set conditions to search for students who meet specific criteria, such as having a grade of “A” and attending more than 90% of the classes. This way, you can quickly identify the students who excel in both academic performance and attendance.

In the following sections, we will guide you on how to utilize VLOOKUP with IF statement in Google Sheets to perform these kinds of operations.

Unleash the Power of VLOOKUP with IF statement in Google Sheets

The VLOOKUP function helps us find values in a table, while the IF function allows us to return values based on specific conditions. By combining these two functions, we can enhance the capabilities of the VLOOKUP formula and accomplish more tasks.

Let’s consider a table that shows different prices for the same foods in two different eateries. If we want to find the price of a particular food using VLOOKUP, it’s straightforward. We just need to provide the food name and specify the data range.

However, what if we want to quickly switch between eateries to compare chicken wings prices? Or if we want to check if a food is ready based on the order placement time? Unfortunately, these tasks are not easily achievable with the basic VLOOKUP formula since it doesn’t support regular expressions by default.

The upcoming example will demonstrate a different approach by combining VLOOKUP with the IF statement in Google Sheets. This combination will enable us to retrieve foods and their prices based on specific conditions that we define.

How to use VLOOKUP with if statement in Google Sheets- Practical examples

Now that you understand when to use VLOOKUP with if statement in Google Sheets, let’s use this opportunity to review some examples together. 

Here is the sample data for our first example:

In this example, we will use Vlookup with IF statement in Google Sheets to explore both tables for the price of Chicken wings. What we want to do is return the price of this food item for the particular restaurant we want (Food Capitol) 

Here is the formula we will use to achieve that:

=VLOOKUP(I3, IF(I2 = “Food Capitol”,A3:B8,D3:E8), 2, 0)

Now, let’s break down the formula so you understand exactly what we want to do. 

  • First, we need to provide the required parameters of the VLOOKUP function
  • Next, we must provide the IF statement as the second parameter of our VLOOKUP function. Also, we need to mention the conditions we want to be met. 
  • Since our food prices for the particular restaurant are listed in the second column, we will use 2 as the index
  • Our sort value will be either 0 or False. What this means is that we only want the exact value to look up for. 

To break things down, the condition for this example is pretty simple. If “Food Capitol” is the specified eatery, return its data, else return the data for the second eatery. 

Now, let’s show you a practical example so you get a better picture: 

Step 1: Select the cell where you want the result generated

To start with, we need to choose the cell where we want our result to be generated. For this example, we will use cell I4. 

Step 2: Type in your formula

Here is where things get interesting. Navigate to the formula bar and type in the following formula: 

=VLOOKUP(I3, IF(I2 = “Food Capitol”,A3:B8,D3:E8), 2, 0)

Step 3: Hit Enter

Once you have typed in your formula, you only need to hit the Enter button on your keyboard. Google Sheets will automatically generate the result in the selected cell. 

Here is what ours looks like: 

That wasn’t too difficult, was it? 

Use VLOOKUP with IF statement in Google Sheets for comparison operators

If you followed our first example, we are sure by now you know exactly how to use VLOOKUP with if statement in Google Sheets. 

But there is more. Let’s quickly show you how to use VLOOKUP with if statement in Google Sheets for comparison operators. 

Before we jump into the practical aspects, here are some things you should know: 

Comparison operators, like greater than (>) and less than (<), allow us to compare different expressions or values and obtain a result of either TRUE or FALSE. These operators are essential in conditional statements, where we need to make decisions based on certain conditions.

Let’s use our earlier example to determine when food would be ready. We will slightly modify our table to include a third column for this example. We will use the column to show when a customer placed an order. 

Let’s say every order at Food Havana placed before a specified is ready for delivery, and those placed after that time aren’t, we can model our condition as follows:

= IF(VLOOKUP(H3,B2:D7,3,FALSE) < 10, “Food is ready!” , “Food is not ready”)

Now let’s apply the above formula to our spreadsheet to see what it gives us. 

Step 1: Choose the cell where you want the result generated

Start by choosing the cell where you want the result generated. For this example, we will use cell H4. 

Step 2: Type in the formula

Navigate to the formula bar and type in the following formula: 

= IF(VLOOKUP(H3,B2:D7,3,FALSE) < 10, “Food is ready!” , “Food is not ready”)

Step 3: Tap Enter 

With our formula typed in, we can now hit the Enter button on our keyboard. Google Sheets will automatically generate the result in our selected cell. 

Here, take a look at what ours looks like: 

From the image above, you can see that Double Sausage Pizza is ready for delivery. 

Now, that’s how to use VLOOKUP with if statement in Google Sheets to perform conditional VLOOKUP. 

Final Thoughts

The VLOOKUP formula in Google Sheets is a valuable tool for searching and retrieving specific data within large datasets. By leveraging the vertical lookup capabilities of VLOOKUP, we can locate desired information by searching for keys in a designated column. 

However, it is important to acknowledge the limitations of the VLOOKUP function when it comes to retrieving data. 

Fortunately, this guide has demonstrated how combining the VLOOKUP with IF statement in Google Sheets enables us to surpass these limitations and perform more advanced operations. 

By incorporating conditional statements and logical checks, we can enhance the functionality of VLOOKUP and overcome challenges associated with retrieving data from complex datasets. 

This powerful combination empowers users to manage and extract relevant information from their Google Sheets efficiently, ultimately improving productivity and data analysis capabilities.