In Google Sheets I have two columns, A and B, and want to know when a cell in column A contains a word that is not in column B.
Column A contains cells with multiple words per cell, comma separated:
sarah, john, esther
sarah, john
yara, sarah
Column B contains one word per cell like:
sarah
john
esther
I want to know when a word in the first column is not in the second column. In our example, that would be yara
.
Ideally that cell would go red, or another cell in the same row would show a warning.
Best Answer
You can do this by applying to range A1:A the conditional formatting with custom formula
Explanation.
counta(unique(B$1:B))
counts the number of distinct words in column B.A1&", "&JOIN(", ",B$1:B)
concatenates A1 with the content of column B, comma-and-space separated.split(...,", ")
separates all of this into a row of wordscounta(unique(transpose(...)))
counts the number of distinct words among these.