Compare two strings and look for matching text

bomfunk

New Member
Joined
Mar 1, 2016
Messages
3
I would like to compare two columns to find matching text, and if there is, return "Match" on third column.

For example:

In A1:
XY12345 Cats and Dogs

In B1:
Batman with the Flash 12345

Since they both contain "12345", I will get "Match" in C1


Please tell me how to accomplish this with a formula. Thank you
 

Some videos you may like

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

sericom

Well-known Member
Joined
Jan 19, 2006
Messages
915
That could be tricky unless the words have to be separated with a space.
eg 'an' and 'a' are in both those examples
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,271
Office Version
  1. 365
Platform
  1. Windows
Hi. I think im right in saying that the simple answer is you cant, at least you cant without more rules. They both contain an 'a' aswell. Does that make them a match? Do you understand what I mean? And even with more rules it would probably require VBA.
 

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,465
Office Version
  1. 365
Platform
  1. Windows
3 or more

Hi, here is one possible option you could try:

<b>Excel 2013</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB"><colgroup><col width="25px" style="background-color: #DAE7F5" /><col /><col /><col /></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="color: #333333;;">XY12345 Cats and Dogs</td><td style="color: #333333;;">Batman with the Flash 12345</td><td style="background-color: #FFFF00;;">Match</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="color: #333333;;">XY12 Cats and Dogs</td><td style="color: #333333;;">Batman with the Flash 12345</td><td style=";">Not Match</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="color: #333333;;">XY12 Cats and Dogs</td><td style="color: #333333;;">Batman wiXY12 Flash 123</td><td style=";">Match</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="color: #333333;;">not a match</td><td style="color: #333333;;">ot a ma</td><td style=";">Not Match</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style="color: #333333;;">is a match</td><td style="color: #333333;;">bla atc bla</td><td style=";">Match</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style="color: #333333;;">ham egg and chips</td><td style="color: #333333;;">hamburger and fries</td><td style=";">Match</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><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: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><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: #DAE7F5;color: #161120">C1</th><td style="text-align:left">=IF(<font color="Blue">SUMPRODUCT(<font color="Red">--(<font color="Green">ISNUMBER(<font color="Purple">SEARCH(<font color="Teal">MID(<font color="#FF00FF">SUBSTITUTE(<font color="Navy">A1," ","|"</font>),ROW(<font color="Navy">INDEX(<font color="Blue">A:A,1</font>):INDEX(<font color="Blue">A:A,LEN(<font color="Red">A1</font>)-2</font>)</font>),3</font>),B1</font>)</font>)</font>)</font>)>0,"Match","Not Match"</font>)</td></tr></tbody></table></td></tr></table><br />
 

Watch MrExcel Video

Forum statistics

Threads
1,122,798
Messages
5,598,112
Members
414,214
Latest member
marketingnumbersguy

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
Top