'Trying to query for cell above contains
I have a column of data that contains names, and the name always appears above a cell which contains parentheses. I'm able to run a query that shows those cells
=query(A:A,"Select * where A contains '('",)
but it's the cells directly preceding them that I need. Any help would be appreciated.
Solution 1:[1]
Try the following:
=index(hlookup("z",{"z";A:A},filter(row(A:A),regexmatch(A:A,"\(")),0))
You can replace the two occurrences of z with whatever you want.
The formula is self-explanatory if you are familiar with HLOOKUP and arrays.
Solution 2:[2]
try:
=QUERY(A:A; "skipping 2")
or:
=QUERY(A:A; "where not A contains '('")
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 | ztiaa |
| Solution 2 | player0 |

