Check if cell contains partial text string based on string in another cell

silviosilver

New Member
Joined
Aug 12, 2015
Messages
24
I want to check whether a cell contains a partial match with a text string in another cell.

Say A1 contains the string ABCDEFG, I want to check if B1 contains any part of ABCDEFG - eg ABC or CDE or DEFG.

But I don't want to have to manually enter "ABC" or "CDE" or "DEFG" in searching for a match, I want this to occur automatically based on the string that is (in this example) in A1.

How can I do this?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
What's the minimum length of text that counts as a matching part?
 
Upvote 0
So not ABC or CDE then? ;)

Which version of Excel do you have?
 
Upvote 0
So not ABC or CDE then? ;)

Which version of Excel do you have?
Pardon my lack of specificity. Three letters may well do, but I think a minimum of four would be better. (The actual strings I have are about 20 characters, but quite distinct, so four should do nicely.)

2016 version.
 
Upvote 0
like this?

RawDataIsInContains
ABCDEFGCDEFTRUE
ABCDEFGHJKFALSE
ABCDEFGGHIFALSE
ABCDEFGBTRUE
ABCDEFGDETRUE
ABCDEFGAGFALSE
 
Upvote 0
It would probably help if you gave us some representative samples of your actual column A and B data. Certainly what I think you want is very different from what Sandy is suggesting, which would be a very simple SEARCH/FIND formula.
 
Upvote 0
like this?

RawDataIsInContains
ABCDEFGCDEFTRUE
ABCDEFGHJKFALSE
ABCDEFGGHIFALSE
ABCDEFGBTRUE
ABCDEFGDETRUE
ABCDEFGAGFALSE

Yes, like that.

Although I'd actually prefer if column C returned the portion of string from column B that was found in column A. So C1 in your example would return CDEF rather than TRUE.
 
Upvote 0
It would probably help if you gave us some representative samples of your actual column A and B data. Certainly what I think you want is very different from what Sandy is suggesting, which would be a very simple SEARCH/FIND formula.

I had in mind the kind of thing Sandy gave as an example. I could do a SEARCH to find it, but didn't know how to do it without manually entering "CDEF". I want Excel to do automatically check if any of column A can be found in column B.
 
Last edited:
Upvote 0
like this?
RawDataIsInContains
ABCDEFGCDEFCDEF
ABCDEFGHJK
ABCDEFGGHI
ABCDEFGBB
ABCDEFGDEDE
ABCDEFGAG


btw. this is case sensitive
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,849
Members
449,194
Latest member
HellScout

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