Google-sheets – How to ignore certain strings when creating unique list of words in Google Sheets

formulasgoogle sheetsgoogle-sheets-arrayformulagoogle-sheets-queryregex

In Google Sheets, I am using the formula to create a unique list of words:

=unique(transpose(split(ArrayFormula(concatenate(B2:E"+")),"+")))

But I want to filter out certain strings.

My unique list looks like so:

On the road
Eggs
Bacon
Bread
Hashbrowns
Spreads
Baked Beans
Coffee
Avocado
Pub Roast
Sandwhich meet
Lettuce
Tomato
mustard
mayo
Tom to suss
James to suss
Crisps
Cheese
Crackers
Muslie Bars

I want to filter out strings like Tom to suss, James to suss, On the road, etc.

Best Answer

=ARRAYFORMULA(QUERY(UNIQUE(REGEXREPLACE(A1:A, 
 "Tom to suss|James to suss|On the road", "")), 
 "where Col1 is not null"))

0


=ARRAYFORMULA(TRANSPOSE(QUERY(UNIQUE(REGEXREPLACE(A1:A, 
 "Tom to suss|James to suss|On the road", "")), 
 "where Col1 is not null")))

0