Compare two columns row by row, count substring matches

jokr1

New Member
Joined
Jan 10, 2016
Messages
46
I want to compare columns A and B, row by row, where values in B might contain substrings of A.
How can I count the number of substring matches ("am" in hamster, "bit" in rabbit, "us" in mouse and "squirrel" in squirrel) with a formula? (Do not want to use column C at all to indicate if each row is a match or not)

I guess I have to use countifs or sumproduct? But don't know how to do it in this specific case.

1624633438862.png
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,938
Office Version
  1. 365
Platform
  1. Windows
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,700
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Substitute SEARCH for FIND if you want to ignore case in your matches.
Book1
ABCD
1frogme
2hamsteram
3catematches
4rabbitbit4
5mouseus
6gorrilahey
7squirrelsquirrel
Sheet2 (2)
Cell Formulas
RangeFormula
D4D4=SUMPRODUCT(--ISNUMBER(FIND($B$1:$B$7,$A$1:$A$7)))
 

Forum statistics

Threads
1,148,160
Messages
5,745,123
Members
423,927
Latest member
Pra56

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