Search for multiple text strings in multiple cells in excel, part 2
Jerome asks, in this blog post Search for multiple text strings in multiple cells in excel :
If the list of strings in column D was to increase to a large number e.g. 15, how would you tell excell to select the range of strings, so that you don't have to select each string "SEARCH($D$3" in the search parameter, as it seems is the case at the moment?
Picture from blog post "Search for multiple text strings in multiple cells in excel"
Answer: The formula presented below extracts all records that contain any of the search strings, see picture below. This is not exactly what Jerome asks for but I thought this could be interesting enough.
Jerome asks for all records that contain all search strings. I have to think some more to solve Jeromes question.
Formula in G2:G12:
=INDEX(List, SMALL(IF(ISERROR(SEARCH(Search_strings, TRANSPOSE(List))), "", TRANSPOSE(ROW(List)-MIN(ROW(List))+1)), ROW(List)-MIN(ROW(List))+1)) + CTRL + SHIFT + ENTER
If more than one search string are found in a cell, duplicates (or more) are created in the search result. (See picture above)
Named ranges
List (A2:A12)
Search_strings (D2:D3) Change this range if you want to include more search strings
What is named ranges?
How to implement array formula to your workbook
Change named ranges.
Download excel example file.
search-for-multiple-strings-in-multiple-cells-part2.xls
(Excel 97-2003 Workbook *.xls)
Functions in this article:
IF(logical_test;[value_if:true];[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE
COUNT(value1;[value2])
Counts the number of cells in a range that contain numbers
ROW(reference) Returns the rownumber of a reference
ISERROR(value)
Checks whether a value is an error and returns TRUE or FALSE
SMALL(array,k) Returns the k-th smallest row number in this data set.
SEARCH() Returns the number of the character at which a specific character or text string is first found, reading left to right (not case sensitive)
INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range
TRANSPOSE(array)
Converts a vertical range to a horizontal range, or vice versa.
Related blog posts
- Search for multiple text strings in multiple cells and use in data validation in excel
- Search and display all cells that contain all search strings in excel
- Search for multiple text strings in multiple cells in excel
- Lookup with multiple criteria and display multiple search results using excel formula, part 4
- Lookup with multiple criteria and display multiple unique search results (array formula)








May 6th, 2011 at 8:44 pm
Know if you whant to know what string was found in each case that one was found.
Example.
In you post above
A3 contains the text BAA
And on cell G3 you have the same value becouse it found B string from the Search_strings. Whant i will whant is for it to post B becouse that is wat was found. Thanks
May 6th, 2011 at 9:03 pm
or a diferent way of asking,
If A value from the list apears on cell A1, What is that value.
May 9th, 2011 at 7:30 am
carlos padron,
Array formula in H2:
Copy cell H2 and paste down.
See attached file
November 7th, 2011 at 5:33 pm
Hi - I have a worksheet that contains a list of line items such as, "Service Tee Top Ent 1inx32mm Primofit" I want to find and extract the "32mm" portion of the text, but have some 15 different variants, like, 40mm; 20mm.
The text lengths are different in length - the common denominator is that the number always has "mm" after it.
Any ideas guys !
November 9th, 2011 at 8:11 am
Paul,
are there always two numbers before "mm"?
November 9th, 2011 at 8:38 am
Hi - there are always 2 or 3 numbers before the mm ...it's pipe diameter sizes, eg 75mm; 100mm; 450mm
Thanks, Paul
November 9th, 2011 at 8:50 am
..forgot to add, that there will be a different length of text string before the '32mm' portion.
November 9th, 2011 at 9:42 am
Paul,
Open attached file:
Paul.xls
Formula in cell B1:
December 3rd, 2011 at 1:54 am
Column “A” row has some TEXT Value
Example: Canada
And
Column “B” row has Some TEXT Value (Similar as “A” and also some other TEXT) .
Example: “Canada is great place”
How to Match or compare to find if Canada is present in Column “B” row
December 3rd, 2011 at 2:04 am
There are more than 100+ Row in column “A” have TEXT value and Column “B” has multiple values TEXTs.
Need to compare Column A and B.
How to compare (Cell ‘A’) with Column “B” to find specific TEXT value from Column “B”
December 3rd, 2011 at 5:02 pm
Raju,
read this post: Return multiple matches with wildcard vlookup in excel
December 19th, 2011 at 12:30 pm
Hi,
I'm working on pivot tables. I've a unique requirement to create a measure that counts the number of rows matching the "string" in a column.
for eg:
column_value: "cancel the membership"
I would like to create a measure which search for text "cancel" and counts.
COUNTROWS(...)
could you please help?
thank you.
December 23rd, 2011 at 1:22 pm
Shyam,
=COUNTIF(range, "*string*")
This post might be helpful:
Excel 2007 pivot table: Count unique distinct records (rows)
December 30th, 2011 at 9:52 pm
How can we match case in
=INDEX(Search_strings, MIN(IF(COUNTIF(G2, "*"&Search_strings&"*"), ROW(Search_strings)-MIN(ROW(Search_strings))+1, ""))) + CTRL + SHIFT + ENTER
January 6th, 2012 at 1:55 pm
Ram,
Try this formula: