MS Excel provides various options and methods to make our tasks easier. In this article, I will show some ways to check if one cell equals another and then return another cell in Excel.

## How to Check If One Cell Equals Another & Then Return Another Cell in Excel: 5 Ways

Here, we will show you 5 different ways to check if one cell equals another and then return another cell in Excel using different functions.

### 1. Use IF Function to Check If One Cell Equals Another & Returns

The** IF **function is one of the simplest functions that is used to do a logical comparison between two values. In this method, we will see how to use the **IF **function to compare one cell with another and return another cell value. Before going to the example let’s know more about this function. The syntax of the function is like this:

`=IF(logical_Condition, [value_if_true], [value_if_false])`

In the first portion of the parameter, we need to pass our condition based on which we are going to compare. Then the second and third part defines what will be if the values after comparison get **True **or **False**.

#### 1.1 Returning Exact Value of Cell

Assuming, we have a dataset of some **Fruits **with two columns. Every row has a specific Value. Now we will find the rows where **Fruits 1 **and **Fruits 2 **are matched and display their values in the **Matched Values** column.

To do that, go through the steps given below.

**Steps:**

- Firstly, enter the below formula in cell
**D4**.

`=IF(B5=C5,D5,"")`

- Now, press
**Enter**. - Then, drag down the
**Fill Handle**tool to**AutoFill**the formula for the rest of the cells.

**IF**function, using the condition

**B5=C5**we are comparing the

**Fruits Name**of each column

**Fruits 1**and

**Fruits 2**. If the condition gets

**True**, then it will print the values from the

**Value**column into

**Matched Values**column.

- Thus, you can return a specific cell value if one cell equals another cell.

#### 1.2 Updating Resultant Value

In this method, we will use the same **IF **function, and depending on the condition we will use a formula and show them in another cell. Let’s think about the same dataset used in the previous method but here I will update the new Price if the **Flag **value is not** “X” **and our new price will be 2 times the current price.

**Steps:**

- In the beginning, enter the following formula in cell
**E5**.

`=IF(D5<>"X",C5*2,C5)`

- After that, press
**Enter**and copy down the formula up to cell**E9**.

**D5<>” X”**we are checking if the

**Flag**value is not equal to

**“X”**or not. If the condition is

**True**then it will double the price otherwise it will remain the same.

- Finally, you will get all the required resultant values updated.

### 2. Return Another Cell Value Using VLOOKUP Function

In terms of searching for something in Excel, the** LOOKUP **function will be the proper choice for that. This function allows us to search vertically or horizontally within a condition in a certain range. For those specific purposes, there are **VLOOKUP** and **HLOOKUP** functions in Excel. Let’s see the fundamentals of the **VLOOKUP **function. The syntax of the function is like this:

`=VLOOKUP (value, table, col_index, [range_lookup])`

Firstly, the **value ->** carries the value to look for in the first column of a table.

**table -> **Here will be the table name.

**col_index ->** It is the column index value of the table from where we will collect a value.

**[range_lookup] ->** This last section is for denoting the optional range.

For example, consider a dataset of some **Fruits **like before. But here we will have 3 columns which are **Fruits**, **ID**, and **Price**. Now we will search Fruits’ prices from this table using **VLOOKUP**.

**Steps:**

- Firstly, enter the following formula in cell
**G4**.

`=VLOOKUP(G4,B4:D9,3,0)`

- Next, press
**Enter**. - Thus, you can find any other Fruit’s price by entering the
**Name**on**Cell G4**.

**G4**, then the table from where we want to extract data which is indicated by cell range

**B4:D9**in the whole table. After that in the third part, we will get the values from the

**Price**column which is column no

**3**that’s why we need to pass

**3**. Lastly,

**0**is used to specify that we want an exact match.

### 3. Apply Excel HLOOKUP Function to Scan Matching Value

Now we will see the uses of **HLOOKUP **functions if our data is horizontally designed. The syntax of the **HLOOKUP **functions is:

`=HLOOKUP (lookup_value, table_array, row_index, [range_lookup])`

It is almost like the **VLOOKUP **function. The only difference is instead of having a column index here is the row index in the 3rd part of the parameter.

**Steps:**

- In the beginning, select cell
**C9**and insert the following formula.

`=HLOOKUP(C8,B4:G6,3,0)`

- Then, press
**Enter**. - Finally, we can see the result.

**VLOOKUP**. Here I have passed the row-wise value instead of column-wise. That’s why first we entered the row index of our desired value which is cell

**C8**. Besides, the table range also changes as our table is shifted horizontally.

### 4. Check If One Cell Equals Another with INDEX & MATCH Functions

In this section, we will do the same thing done by the **LOOKUP **function, but the only difference is here we will not use the **LOOKUP **function. **INDEX** and **MATCH** functions will do the same thing as **LOOKUP**. Also, the dataset will be the same as well. Before going to the example let’s see the details about these two functions.

`=INDEX (array, row_number, [col_number], [area_number])`

This function can take a maximum of four arguments and a minimum of two arguments. In the first section of its parameter, it takes the range of cells from where we will check the index value. Then comes the row number of reference or matching value. The last two arguments are optional with them we can define or specify the column number from where the matched data will be retrieved and the area range number.

`=MATCH (lookup_value, lookup_array, [match_type])`

Another mostly used function is the **MATCH **function. The first argument takes the lookup value or the value we are going to match. The second one is the array or range where we will search our desired data. And the last one is the match type. Depending on different match type values we can control matching.

**1 ->** By declaring 1 it will match or find the largest value less than or equal to the lookup value.

**0 ->** If we put 0 as a match type it will match the value which is exactly as the lookup value.

**-1 ->** This will match the smallest value greater than or equal to the lookup value.

Follow the steps given below to use these two functions.

**Steps:**

- Firstly, enter the formula in cell
**G5**.

`=INDEX(B4:D9,MATCH(G4,B4:B9,0),3)`

- Secondly, press
**Enter**. - In the end, we can see the final result.

**MATCH**function, we tried to match the value which is in cell

**G4**from the cell range

**B4:B9**in our lookup table. And as we considered the

**exact match**that’s why

**0**is assigned at the last argument. Then, the outer function is the

**INDEX**function. In the first part, we have assigned the cell range

**B4:D9**. Then the matched value will be calculated from the

**MATCH**function. Lastly,

**3**is used as we want to get data from the third column of our lookup table.

### 5. Return Items from Another Worksheet with Matching Value in Excel

Let’s have two worksheets, one is **Weekly Meals**, and another is **Ingredients**. Now I will show how to compare meals and show the ingredients in the first worksheet. The **Week Meals Planning **worksheet will be like this:

The meals ingredients worksheet will be like this:

Now, I will show how to find the food ingredients from the **ingredient** worksheet to the **Meal **worksheet by entering the name of the food in cell** B14**.

**Steps:**

- To start with, enter the formula in cell
**C14**.

`=VLOOKUP($B14,ingredients!$B$5:$E$16,COLUMN()-1,FALSE)`

- After that, press
**Enter**. - Then, copy the formula to the right side.

**$B14**, then the other worksheets (ingredients worksheet) cell range

**$B$5:$E$16**is sent. After that, we passed the

**COLUMN**function to get the column value of that row. Lastly, we used

**FALSE**to find an exact match, which means it is case sensitive and by declaring false it will search for the exact value matching.

- Finally, all the ingredients of the selected
**Food**will be displayed.

You can check by typing any food name in cell** B14 **and pressing **Enter**. Same way if just type any food item under **Food Name**, it will show all the ingredients of that selected item from another worksheet.

## Practice Section

In the article, you will find an Excel workbook like the image given below to practice on your own.

**Download Practice Workbook**

You can download the workbook to practice yourself.

## Conclusion

These are the ways to check if one cell equals another and then return another cell in Excel. I have shown all the methods with their respective examples. Also, I have discussed the fundamentals of this function and the most used format codes of this function. If you have any other method of achieving this, then please feel free to share it with us.

**<< Go Back to | Excel Match | Learn Excel**

Dear Mr Abdullah Al Murad,

I have read your examples with great interest. I have used the example above with INDEX and MATCH to retrieve a value from an Excel sheet of information by using a drop down list to choose the value I want to search for.

=INDEX(Total!A3:G33, MATCH(Testing!$B$2, Total!D3:D33, 0), 1)

The sheet Total contains a number of rows and columns of information, where column D contains years (one year or several comma separated) and column E months (one or several comma separated). Testing!B2 contains a list of years 2021-2031 where I can choose a specific year from the drop down list, and Testing!D2 contains months.

What I really would do is to expand this in three ways. The use case being that as a user I would be able to retrieve specific rows from the sheet Total by choosing the year and month of interest and displaying them in the sheet Testing.

Firstly I would like to retrieve all lines from the table of information that matches the input criteria. So if I choose 2025, all lines containing 2025 should be listed below where I choose from the drop down.

Secondly I would like to choose the lines containing the year even if there are several years in the data. So if the cell Total!D5 contains “2025” or “2025, 2026, 2027” the row should be presented in the result.

Thirdly I want to add a second criteria. I want to be able to choose both year and month from two separate drop downs. So if Testing!B2 is 2025 and Total!D3:D33 contains 2025, or the Testing!E2 contains January (or e.g. January, February) and Total!E3:E33 contains January I should get all rows containing either 2025 or January.

I hope you can help me with this as I think this is probably easy for you 🙂 I have been programming PERL and Java but to implement algorithms with the functions in Excel is a bit beyond me.

Thank you for a very good instructional site on Excel!

Thanks a lot OSCAR APPELGREN for your questions.

In response to your first question to have matched rows entirely in the drop-down, it is not possible in Excel. A standard drop-down list in Excel does not support multiple rows of data.

If you want to filter multiple rows based on single or multiple criteria, you better use the

FILTERfunction. It is not applicable to the older Excel version. It helps you to extract multiple matched rows quite easily thanINDEX-MATCHfunctions.According to your requirements to extract matched rows based on single criteria (i.e. year 2025), I have used the following formula which works pretty well.

=FILTER(B3:E17,D3:D17=H4)And, for sorting rows with multiple criteria, you just need to use the asterisk sign(

*) and insert the other condition.=FILTER(B3:E17,(D3:D17=H4)*(E3:E17=H5))Fantastic, thank you! Just what I needed.

Dear

Aspen,You are most welcome.

Regards

ExcelDemy