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 calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
That could be tricky unless the words have to be separated with a space.
eg 'an' and 'a' are in both those examples
 
Upvote 0
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.
 
Upvote 0
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")
 
Upvote 0

Forum statistics

Threads
1,214,394
Messages
6,119,262
Members
448,880
Latest member
aveternik

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