Search for Text in column

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,632
Office Version
  1. 365
Platform
  1. Windows
Without VBA, is it possible to return the number of times a text string appears in a column?
1722859026777.png


Basically I need to count how many times the strings in the Test List column appear in the Search String column


TIA
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You may need to clarify exactly what you mean by this.
how many times the strings in the Test List column appear in the Search String column

For example.
  1. If the Search String column contained "Text 15 | Text 2" then the string "Text 1" is found within that. Would you want that counted?

  2. If the Search String column contained "Text 1 | Text 2 | Text 1" would you want "Text 1" counted once or twice for that row?
 
Upvote 0
You may need to clarify exactly what you mean by this.


For example.
  1. If the Search String column contained "Text 15 | Text 2" then the string "Text 1" is found within that. Would you want that counted?

  2. If the Search String column contained "Text 1 | Text 2 | Text 1" would you want "Text 1" counted once or twice for that row
 
Upvote 0
A fair point...I think I need to include a suffix of ' | ' at the end so that each text string is unique

So the Search Strings would be
Text 1 | Text 5 |
Text 2 | Text 1 | Text 4 |
 
Upvote 0
You may need to clarify exactly what you mean by this.


For example.
  1. If the Search String column contained "Text 15 | Text 2" then the string "Text 1" is found within that. Would you want that counted?

  2. If the Search String column contained "Text 1 | Text 2 | Text 1" would you want "Text 1" counted once or twice for that row?
Each of the possible items in the text List will only every appear once. There would never be an instance of Text 1 | Text 2 | Text 1 |
 
Upvote 0
There would never be an instance of Text 1 | Text 2 | Text 1 |
OK, thanks.

..I think I need to include a suffix of ' | ' at the end so that each text string is unique
Put one at the start as well then try something like this

24 08 05.xlsm
ABCD
1
2Text 12|Text 1|Text 5|
3Text 21|Text 2|Text 1|Text 4|
4Text 30
5Text 41
6Text 51
Count String
Cell Formulas
RangeFormula
B2:B6B2=BYROW(A2:A6,LAMBDA(r,COUNTIF(D2:D3,"*|"&r&"|*")))
Dynamic array formulas.
 
Upvote 0
Solution
Try this:

Book1
ABCD
1
2Text 12Text 1 | Text 5 |
3Text 21Text 2 | Text 1 | Text 4 |
4Text 30
5Text 41
6Text 51
Sheet1
Cell Formulas
RangeFormula
B2:B6B2=COUNTIF($D$2:$D$3,"*"&A2&" |*")
 
Upvote 0
OK, thanks.


Put one at the start as well then try something like this

24 08 05.xlsm
ABCD
1
2Text 12|Text 1|Text 5|
3Text 21|Text 2|Text 1|Text 4|
4Text 30
5Text 41
6Text 51
Count String
Cell Formulas
RangeFormula
B2:B6B2=BYROW(A2:A6,LAMBDA(r,COUNTIF(D2:D3,"*|"&r&"|*")))
Dynamic array formulas.
Great stuff!!!
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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