ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Searching and adding a value. (https://www.excelbanter.com/excel-worksheet-functions/100170-searching-adding-value.html)

rmg

Searching and adding a value.
 
Hi,

I have 1 workbook with 2 worksheets.

Worksheet 1 has:
Column a
nm123
mf837
mn187
lk193

Worksheet 2 has:
Column a Column b
kd298 x
er549 x
jk981 y
nm123 x
mf837 x
lp182 y
nj765 y
mn187 t

As you can see, three of the values in worksheet 1 column a are also in
worksheet 2 colum a.

If that is the case I want to populate worksheet 1 column b with the
relevant value from worksheet 2 column b

e.g. in worksheet 1 I would end up with:

Column a Colum b
nm123 x
mf837 x
mn187 t
lk193 (Blank because its not in worksheet 2 column a

I think I can do it with a VLOOKUP but Im struggling with what to put
in.

Please can anyone help?

Thanks.

--
rmg.
gmail is a spamtrap
use rmgwmyahoocouk


Bearacade

Searching and adding a value.
 

Put this in Sheet1, B1

=IF(COUNTIF(Sheet2!$A:$A,A1)0, VLOOKUP(A1,Sheet2!$A:$B,2,FALSE), "")

You have to put the if statement in there or else you are going to get
#N/As


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=562917


rmg

Searching and adding a value.
 

Bearacade wrote:
Put this in Sheet1, B1

=IF(COUNTIF(Sheet2!$A:$A,A1)0, VLOOKUP(A1,Sheet2!$A:$B,2,FALSE), "")

You have to put the if statement in there or else you are going to get
#N/As


Thank you very much Bearacade.

--
rmg.



All times are GMT +1. The time now is 01:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com