'Filter function: How to include a row if column B matches condition OR column C matches condition
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.
Solution 1:[1]
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:
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:
Solution 2:[2]
use:
=FILTER(A1:A, REGEXMATCH(B1:B&C1:C, "tag1"))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | player0 |


