# IF value is same in two columns then display a third value from another column

#### Rick187

##### New Member
Hi,

Does anyone know which formula can achieve this:

If value in column A is the same as value in column B, then display the value from Column C

For example if Column A contains these values

C1 - AAA
C2 - BBB

Column B contains the same:
B1 - AAA
B2 - BBB
B3 - CCC

Column C contains
C1 - London
C2 - New York
Etc.

In Column D, I would like it to insert the value from Column C, so next to "AAA", I would like it to display "London"

Any help would be appreciated.

### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.

#### Tim_Excel_

##### Well-known Member
Code:
``=IF(A1=B1,C1,"")``
This is the simplest of formulas... Maybe consider googling the problem before opening a new thread?

#### Rick187

##### New Member
Unfortunately this doesn't seem to work when the columns are in different sheets.

I've tried this: =IF('Sheet1'!A:A=Sheet2!G:G,Sheet2!I:I,"")

#### Tim_Excel_

##### Well-known Member
Again, Google is your best friend... (although one could argue it isn't because of privacy reasons, but that's another topic)

Code:
``[COLOR=#333333] =IF([/COLOR]Sheet1![COLOR=#333333]A:A=Sheet2!G:G,Sheet2!I:I,"")[/COLOR]``

#### Rick187

##### New Member

Again, Google is your best friend... (although one could argue it isn't because of privacy reasons, but that's another topic)

Code:
``[COLOR=#333333] =IF([/COLOR]Sheet1![COLOR=#333333]A:A=Sheet2!G:G,Sheet2!I:I,"")[/COLOR]``
This doesn't seem to work. Nothing displays when I use this formula.

#### Tim_Excel_

##### Well-known Member
It does work on my end when I use regular text and number values. I'm assuming there's some information missing here. What do these ranges contain?

#### Rick187

##### New Member

It does work on my end when I use regular text and number values. I'm assuming there's some information missing here. What do these ranges contain?
They contain text.

In Sheet 1 If the value from A2 is contained in a range from another sheet (Sheet 2 Column G), then Display the corresponding Value from (Sheet 2 Column I)

So if I have the word "Cat" in the the first sheet in Cell A2, and in sheet 2 Column G I have 30 different words and one of them is "Cat", Next to the word "Cat" in "Column I" It says "London". I would like the word "London" to display in Sheet 1 cell B2.

seen post#7

Last edited:

#### Tim_Excel_

##### Well-known Member

For this you will have to use the MATCH function. This will return the row number of the found value, or #N/A if the value was not found. You can then return the value of the cell next to it. Use the IFNA function to handle values that won't be found.

#### jtakw

##### Well-known Member
Hi,

Change "No Match" to "" (Blank) or whatever you like, formula copied down:

1,106,332
Messages
5,510,666
Members
408,807
Latest member
m505753

### This Week's Hot Topics

• Turn fraction around
Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
• TIme Clock record reformatting to ???
Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
• TextBox Match
hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
• Using Large function based on Multiple Criteria
Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
• Can you check my code please
Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
• Combining 2 pivot tables into 1 chart
Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...