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
 

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,713
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,689
Office Version
  1. 365
Platform
  1. Windows
3 or more

Hi, here is one possible option you could try:


Excel 2013
ABC
1XY12345 Cats and DogsBatman with the Flash 12345Match
2XY12 Cats and DogsBatman with the Flash 12345Not Match
3XY12 Cats and DogsBatman wiXY12 Flash 123Match
4not a matchot a maNot Match
5is a matchbla atc blaMatch
6ham egg and chipshamburger and friesMatch
Sheet1
Cell Formulas
RangeFormula
C1=IF(SUMPRODUCT(--(ISNUMBER(SEARCH(MID(SUBSTITUTE(A1," ","|"),ROW(INDEX(A:A,1):INDEX(A:A,LEN(A1)-2)),3),B1))))>0,"Match","Not Match")
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,461
Messages
5,831,770
Members
430,088
Latest member
meagerd

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