Vlookup

excelesha

Board Regular
Joined
Apr 19, 2023
Messages
65
Office Version
  1. 365
Platform
  1. Windows
Hello, I would like vlookup to return REG if the cell contains REG in it, or otherwise return blank cell if the cell does not contain REG, see below:

Thanks in adnance.

Sheet 1Sheet 2
Col ACol BCol ACol B
appleabcapple
orangeabc regorangeREG
peachsell regpeachREG
mangosellmango
limelime
berryITS RegberryREG
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
If Col A on Sheet 2 will always be in the same order as Col A on sheet 1 try formula for example 1 (cell E3).
If Col A on sheet 2 can be in a different order try formula in example 2 (cell H3).
Change ranges to match your data and sheet names.

Book2
ABCDEFGH
1Sheet 1Sheet 2EX-1Sheet 2EX-2
2Col ACol BCol ACol BCol ACol B
3appleabcapple orangeREG
4orangeabc regorangeREGapple 
5peachsell regpeachREGmango 
6mangosellmango peachREG
7limelime berryREG
8berryITS RegberryREGlime 
9
Sheet1
Cell Formulas
RangeFormula
E3:E8E3=IF(ISNUMBER(SEARCH("reg",B3)),"REG","")
H3:H8H3=IF(ISNUMBER(SEARCH("reg",XLOOKUP(G3,$A$3:$A$8,$B$3:$B$8))),"REG","")
 
Upvote 1
Solution
If Col A on Sheet 2 will always be in the same order as Col A on sheet 1 try formula for example 1 (cell E3).
If Col A on sheet 2 can be in a different order try formula in example 2 (cell H3).
Change ranges to match your data and sheet names.

Book2
ABCDEFGH
1Sheet 1Sheet 2EX-1Sheet 2EX-2
2Col ACol BCol ACol BCol ACol B
3appleabcapple orangeREG
4orangeabc regorangeREGapple 
5peachsell regpeachREGmango 
6mangosellmango peachREG
7limelime berryREG
8berryITS RegberryREGlime 
9
Sheet1
Cell Formulas
RangeFormula
E3:E8E3=IF(ISNUMBER(SEARCH("reg",B3)),"REG","")
H3:H8H3=IF(ISNUMBER(SEARCH("reg",XLOOKUP(G3,$A$3:$A$8,$B$3:$B$8))),"REG","")
Thanks so much for the reponse.

Column A will be shuffled, it will not follow the same order......
 
Upvote 0
If Col A on Sheet 2 will always be in the same order as Col A on sheet 1 try formula for example 1 (cell E3).
If Col A on sheet 2 can be in a different order try formula in example 2 (cell H3).
Change ranges to match your data and sheet names.

Book2
ABCDEFGH
1Sheet 1Sheet 2EX-1Sheet 2EX-2
2Col ACol BCol ACol BCol ACol B
3appleabcapple orangeREG
4orangeabc regorangeREGapple 
5peachsell regpeachREGmango 
6mangosellmango peachREG
7limelime berryREG
8berryITS RegberryREGlime 
9
Sheet1
Cell Formulas
RangeFormula
E3:E8E3=IF(ISNUMBER(SEARCH("reg",B3)),"REG","")
H3:H8H3=IF(ISNUMBER(SEARCH("reg",XLOOKUP(G3,$A$3:$A$8,$B$3:$B$8))),"REG","")
the second solution works for shuffled data. Thank you so much.
 
Upvote 0
You're welcome. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,217,335
Messages
6,135,960
Members
449,974
Latest member
riffburn

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?

Disable AdBlock

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
Back
Top