# If value of Cell A2 in Sheet1 match's any cell in column A in Sheet2 / Replace Cell B2 in Sheet1 With B2 in Sheet2

#### justanothernametaken

##### New Member
Hi could use some help. What i have is this below - What i want to do is a VBA code that says if A2 sheet1 can be found in column A of sheet2 replace B2 sheet 1 with what is in B in sheet2. Example is if A2 (John) appears in Column A in Sheet 2, replace B2 sheet1 with whats showing in the following cell in B in this case George. Is this possible? Thanks oh great masters of excel :D

 Column A Sheet1 Column B Sheet1 Column A Sheet2 Column B Sheet2 Name Name Name Name John Brian John George Casey Lloyd Casey Robert Lakisha Derek Lakisha Sydney Jason Paul Jason Ryan Casey Brian Casey Jeremy Derek John Derek Gina Brian Paul Brian Betty

<tbody>
</tbody>

### Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Do you need VBA code for this? It can be done with a simple lookup formula!

Try this formula in cell C2 on sheet 1:
=IFERROR(IF(MATCH(A2,Sheet2!\$A\$2:\$A\$8,0)>0,Sheet2!B2),B2)

Last edited:
Do you need VBA code for this? It can be done with a simple lookup formula!

Try this formula in cell C2 on sheet 1:
=IFERROR(IF(MATCH(A2,Sheet2!\$A\$2:\$A\$8,0)>0,Sheet2!B2),B2)

This was exactly what i needed . Thank you soooo much.

One more question and i will stop being such a noob .

This is what im trying to do -

In Cell G2 i have date, in H2 i have the date of 5/14/2015, in L2 i have 5/15/2015. What i want to do is say if G2 contains the word Date and if H2 is greater than L2 that contains another date output yes. Any magic formula for this one? THANK YOU!!!

This was exactly what i needed . Thank you soooo much.

One more question and i will stop being such a noob .

This is what im trying to do -

In Cell G2 i have date, in H2 i have the date of 5/14/2015, in L2 i have 5/15/2015. What i want to do is say if G2 contains the word Date and if H2 is greater than L2 that contains another date output yes. Any magic formula for this one? THANK YOU!!!

Would you be looking for something like this:

=IF(AND(G2="date",(H2>L2)),"Yes","")

?

This was exactly what i needed. Thank you VERY much

Replies
5
Views
337
Replies
9
Views
178
Replies
9
Views
891
Replies
6
Views
758
Replies
1
Views
767

1,196,414
Messages
6,015,127
Members
441,874
Latest member
saustark

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back