Reputation: 1196
What I'd like to do is the following:
I have one file with 3 sheets (tab1, tab2, and tab3). In each, I have the column name "Company Name" and in tab1 I have two specific columns named 'tab2' and 'tab3' that represent the sheets tab2 and tab3. What I'd like to do is query the sheets tab2 and tab3 to see if there are company names that either match 100% or are similar to what's listed in the 'Company Name' column in tab1.
Example:
Tab1
Company Name
Great Shoes
Tab2
Company Name
Great
Tab3
Company Name
Greatness Shoes Inc
So in the above-mentioned scenario, I'd like to then input into the columns tab2 and tab3 in the sheet tab1 whether or not there was a partial match with a yes or no.
What is the best formula to do this in Excel or Google Sheets? I tried it in Excel but got as far as finding out partial matches with very low accuracy using this formula:
=IF(ISNA(VLOOKUP(B2 "*",'tab2'!$A$2:$A$884,1,FALSE)), "No", "Yes")
Upvotes: 0
Views: 2714
Reputation: 18717
google-spreadsheets has regex functions.
You may try:
=TEXTJOIN(";",1,FILTER(A:A,REGEXMATCH(A:A,A1) + REGEXMATCH(A1,A:A),A:A<>A1))
Notes:
you may manually add some keywords to your list in order to combine similar company names: like a word "Great", which matches all companies with this word inside.
paste it in B1 and copy down.
Upvotes: 1
Reputation: 513
You could use a combination of ARRAYFORMULA
, ISNUMBER
, and SEARCH
. Using the "great shoes" example from Max, if your data is in column, A in B1 you could put:
=ARRAYFORMULA(IF(ISNUMBER(SEARCH("Great",A:A))=TRUE,A:A,""))
So that searches column A for the string "Great." If it is found =TRUE
then whatever is in that cell is returned. If nothing is found ,FALSE
, then a blank is returned ""
. There would not be any need to "copy down." You could modify that "if true" and "if false" statements to modify data as you need. In place of the "Great" string, you could put a cell reference.
You could also use QUERY
in a manner similar to ISNUMBER(SEARCH
. In B1 you could put =QUERY(A:A,"Select A where A contains 'Great'",0)
You could also use INDEX
and MATCH
. If your DATA is in column A in B1 you could put something like =INDEX($A1:$A3,MATCH("Great",$A1:$A3,FALSE)).
You would have to "copy down" the formula for each row. If you want to prevent the #N/A error from showing, wrap that all in an IFERROR
formula. =IFERROR(INDEX($A1:$A3,MATCH("Great",$A1:$A3,FALSE)),"")
.
Upvotes: 1