Filter function: How to include a row if column B matches condition OR column C matches condition

Viewed 39

I have a table like this:

15,tag2,tag1

16,tag1,tag3

..

I want to list all numbers with tag1. I tried the following:

=filter(A1:A, OR(B1:B="tag1", C1:C="tag1")) 

but that does not work.

2 Answers

For this case, you can try using the "+" sign as an OR operator. You can try the following:

=filter(A:C, (B:B = "tag1") + (C:C = "tag1"))

Which results to:

enter image description here

You can also try using the query function as an alternative. You can try using this:

 =query(A:C, "Select A, B, C where B = 'tag1' or C = 'tag1'")

Here is a sample of the code:

enter image description here

use:

=FILTER(A1:A, REGEXMATCH(B1:B&C1:C, "tag1"))
Related