Check Partial value , if match then leave otherwise change

m_vishal_c

Board Regular
Joined
Dec 7, 2016
Messages
209
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi, i have two excel sheet in same workbook.

Sheet1 is having
[TABLE="width: 192"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD][TABLE="width: 192"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]Comapy Name[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]abc ltd[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]def comms[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ghiuniversal pty ltd[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]jklquantas[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Sheet2 is having

[TABLE="width: 180"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]Compnay[/TD]
[TD]value[/TD]
[/TR]
[TR]
[TD]abc[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]de[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]ghi[/TD]
[TD]34[/TD]
[/TR]
[TR]
[TD]jkl[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I am going to apply vlookup on Sheet1 :- B3(abc ltd row) and get value from Sheet2 but it shows "#N/A"

Please advice me how can i get those value?

heaps in advance
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Based on that sample data, try this.


Excel 2016
AB
1Compnayvalue
2abc1
3de2
4ghi34
5jkl4
Sheet2



Excel 2016
AB
1Comapy NameValue
2abc ltd1
3jklquantas4
4ghiuniversal pty ltd34
5def comms2
6hjjghjgh#N/A
Sheet1
Cell Formulas
RangeFormula
B2=LOOKUP(1,SEARCH(Sheet2!A$2:A$5,A2),Sheet2!B$2:B$5)
 
Upvote 0
HI, I just have 1 question. in above code you applied range A2:A5 but what about nnumber of rows. what will be formula.
thanks
 
Upvote 0
Hi,

For your uploaded sample, you need to "swap" the "Find Text", "Within Text" in the SEARCH function like below, I've also included VLOOKUP and INDEX/MATCH formula versions.
Also added IFERROR in case there's No match found.


Book1
ABCD
1Company NameLOOKUPVLOOKUPINDEX/MATCH
2ABC111
3XYZ222
4MMM444444444444
5DD444
Sheet1
Cell Formulas
RangeFormula
B2=IFERROR(LOOKUP(1,SEARCH(A2,Sheet2!A$2:A$5),Sheet2!B$2:B$5),"")
C2=IFERROR(VLOOKUP("*"&A2&"*",Sheet2!A$2:B$5,2,0),"")
D2=IFERROR(INDEX(Sheet2!B2:B5,MATCH("*"&A2&"*",Sheet2!A2:A5,0)),"")



Book1
AB
1Compnayvalue
2ABC AND CO PTY LTD1
3XYZ COMMISSION2
4MMM MARKETING4444
5DD COSTA4
Sheet2
 
Upvote 0
Hi,

For your uploaded sample, you need to "swap" the "Find Text", "Within Text" in the SEARCH function like below, I've also included VLOOKUP and INDEX/MATCH formula versions.
Also added IFERROR in case there's No match found.

ABCD
Company NameLOOKUPVLOOKUPINDEX/MATCH
ABC
XYZ
MMM
DD

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]4444[/TD]
[TD="align: right"]4444[/TD]
[TD="align: right"]4444[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]4[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]4[/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B2[/TH]
[TD="align: left"]=IFERROR(LOOKUP(1,SEARCH(A2,Sheet2!A$2:A$5),Sheet2!B$2:B$5),"")[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]C2[/TH]
[TD="align: left"]=IFERROR(VLOOKUP("*"&A2&"*",Sheet2!A$2:B$5,2,0),"")[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]D2[/TH]
[TD="align: left"]=IFERROR(INDEX(Sheet2!B2:B5,MATCH("*"&A2&"*",Sheet2!A2:A5,0)),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



AB

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]Compnay[/TD]
[TD="align: center"]value[/TD]

[TD="align: center"]2[/TD]
[TD="align: center"]ABC AND CO PTY LTD[/TD]
[TD="align: center"]1[/TD]

[TD="align: center"]3[/TD]
[TD="align: center"]XYZ COMMISSION[/TD]
[TD="align: center"]2[/TD]

[TD="align: center"]4[/TD]
[TD="align: center"]MMM MARKETING[/TD]
[TD="align: center"]4444[/TD]

[TD="align: center"]5[/TD]
[TD="align: center"]DD COSTA[/TD]
[TD="align: center"]4[/TD]

</tbody>
Sheet2

That's very very good. can this formula find something like "ABC'S AND CON PTY LTD". i just add " 's " in sheet2 and sheet 1 has ABC.

Please let me know. heaps thanks
 
Upvote 0
Yes, did you try?


HI Applied below formula in sheet 1

=IFERROR(VLOOKUP("*"&A2&"*",Sheet2!A$2:B$5,2,0),"")


My sheet1 has "abc def" and sheet 2 has "abc's comms"

when i run that above formula it gives me Blank

Please guide me
thanks
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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