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

Rick187

New Member
Joined
Aug 29, 2018
Messages
12
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.

Thanks in advance.
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Tim_Excel_

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

Rick187

New Member
Joined
Aug 29, 2018
Messages
12
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
Joined
Jul 12, 2016
Messages
512
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
Joined
Aug 29, 2018
Messages
12
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
Joined
Jul 12, 2016
Messages
512
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
Joined
Aug 29, 2018
Messages
12
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,557
Office Version
365
Platform
Windows
seen post#7
 
Last edited:

Tim_Excel_

Well-known Member
Joined
Jul 12, 2016
Messages
512
That's a whole 'nother cookie

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
Joined
Jun 29, 2014
Messages
5,146
Hi,

Change/adjust cell references/range, add sheet name, as needed.

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

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th><th>H</th><th>I</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">Cat</td><td style=";">London</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">Dog</td><td style="text-align: right;;"></td><td style=";">New York</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style=";">Pig</td><td style=";">No Match</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">Mouse</td><td style="text-align: right;;"></td><td style=";">Paris</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">Chicken</td><td style=";">No Match</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">Cat</td><td style="text-align: right;;"></td><td style=";">London</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">Dog</td><td style=";">New York</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">Horse</td><td style="text-align: right;;"></td><td style=";">California</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">Cow</td><td style="text-align: right;;"></td><td style=";">Washington</td></tr></tbody></table><p style="width:6.4em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet558</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">B2</th><td style="text-align:left">=IFERROR(<font color="Blue">LOOKUP(<font color="Red">2,1/SEARCH(<font color="Green">A2,G$2:G$6</font>),I$2:I$6</font>),"No Match"</font>)</td></tr></tbody></table></td></tr></table><br />
 

Watch MrExcel Video

Forum statistics

Threads
1,102,202
Messages
5,485,326
Members
407,496
Latest member
PttrsnMrgn

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top