Check if value is a substring in at least of of many strings - excel

i have a column A with strings:
apple
orange
grape
now i have a second column C with many strings:
apples are red
i hate people
squeeze the orange
rotten flesh
clean towels
in column B, i want to put TRUE next to the strings in column A that are substrings of ANY of the strings in column C.
So in this case column B should have:
TRUE
TRUE
FALSE
I looked at this formula on exceljet but not what i'm looking for:
https://exceljet.net/formula/range-contains-one-of-many-substrings

In B1 put:
=ISNUMBER(MATCH("*"&A1&"*",C:C,0))
And copy down

Related

How do I highlight a cell in Excel when all its content is contained in another column

I have a column (column A) that contains a list of text and another column (column B) that contains a smaller list, which is the values that I actually care about. Is it possible to only highlight cells in column A if all of its contents is listed in column B? If so, how?
A B
Apple Apple
Peach Pear
Apple, Pear Plum
Apple, Grape Kiwi
Apple, Pear, Kiwi      
Watermelon, Grape
So in the above example, I would like to highlight A1, A3, and A5 because all of the contents is listed somewhere in column B
use the following formula for the Conditional formatting:
=AND(ISNUMBER(MATCH(FILTERXML("<a><b>"&SUBSTITUTE($A1,",","</b><b>")&"</b></a>","//b"),$B:$B,0)))
If one does not have FILTERXML then they can use:
=SUMPRODUCT(--ISNUMBER(SEARCH("," &$B$1:$B$4&",",","&SUBSTITUTE(A1," ","")&",")))=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1
Noting that the range $B$1:$B$4 must be the size of the lookup values without any blanks

Return first row number in range where string matches any part of cell contents

Say I have three cells (one in each row):
A1
Apple Pear Lime Grape
Tom Bob Cliff Steve
Pi Rho Sigma Theta
There is a string of text in each single cell. Is there a formula I can write that will return the first row in which a given value appears?
For example, say I had cells like this:
Pear 1
Cliff 2
Steve 2
Pi 3
I would like to return the row where that value is a match for the original array of strings. I have experimented with SEARCH, FIND, and others, but these are good for comparing one row to another single row. I'm looking for something that will examine a whole array of rows and return the first reference row.
use MATCH with wildcards:
=MATCH("*"&C1&"*",A:A,0)

Excel formula to check if items from a comma separated list in one cell exist in a comma separated list in another cell?

I have a spreadsheet where every row has two columns, each containing a comma separated list of words or phrases.
Column 1 | Column 2
---------------------------------------------------------
Orange, Pear, Sugar apple, Kiwi | Orange, Sugar apple
Banana, Watermelon, Pomegranate | Strawberry, Banana
I'm trying to create a formula that checks if the items listed in Column 2 are a subset of the items listed in Column 1 and outputs true or false.
In the above example the output should be true for Row 1 and false for Row 2.
The solutions I tried using the search and find functions only work if the items in Column 2 are listed in the same sequence, i.e. if Column 2 is a substring of Column 1.
Use this array formula:
=AND(ISNUMBER(SEARCH(", " & TRIM(MID(SUBSTITUTE(B1,",",REPT(" ",99)),(ROW($XFD$1:INDEX(XFD:XFD,LEN(B1)-LEN(SUBSTITUTE(B1,",",""))+1))-1)*99+1,99)) & ",",", "&A1&",")))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode

How to Count the number of times a cell in one column matches a cell in another column?

I have two columns. Column A is a list of text values. Column B will be individual text values that may or may not match Column A. Across say 20 rows, I want to use something like COUNTIF at the bottom of Column B to count how many answers in Column B match the correct answer in Column A.
For example, if Column A reads:
1. Apple
2. Orange
3. Banana
4. Kumquat
5. Pineapple
Column B reads:
1. Apple
2. Guava
3. Pistachio
4. Kumquat
5. Pineapple
Essentially, rows 1, 4 & 5 all match, thus the sum at the bottom of column B would be 3.
Is there a way to do this with a formula?
You can use something like this:
{=SUM(IF(A1:A5=B1:B5,1,0))}
To use this formula, type in any cell "=SUM(IF(A1:A5=B1:B5;1;0))" and press CTRL+SHIFT+INTRO

Match function to match multiple values

I have two columns
Column A Column B
Apple A
banana B
Grape C
Apple D
Banana F
Now I want to find the row number for row which has data Apple & D.
Is their a way to use Match function to get the row number?
You can use this one:
=LOOKUP(2,1/(A1:A5="Apple")/(B1:B5="D"),ROW(A1:A5))
or non-volatile version (if your ranges starts from first row):
=MATCH(2,1/(A1:A5="Apple")/(B1:B5="D"))
with array entry (CTRL+SHIFT+ENTER).
Alternate, does not require array entry:
=MATCH(TRUE,INDEX(A1:A5&B1:B5="Apple"&"D",),0)
Try this !!
=SUMPRODUCT((MATCH(1,(A1:A5="Apple")*(B1:B5="D"),0)))
Array formula CTRL+SHIFT+ENTER

Resources