1
votes

I have a google sheet (probably similar formula with excel) with two sheets, and I want to have one sheet 'detect' if a cell of a row has a certain string of characters (e.g., it starts with 'blood sample') and collect the rows that match that string.

So the sheet 'Trial' looks like this

A|B
1|3
2|2
3|5
1|4
2|4
2|5
1|5
1|3

From the two columns A and B above, how do you filter to another sheet so that if A = 1, it will display the corresponding value of B (and a few other columns) WITHOUT leaving empty rows in between? So the final result should look like this

A|B
1|3
1|4
1|5
1|3
1

1 Answers

1
votes

You can use a query formula like:

=QUERY('Sheet 01'!A1:B,"where A=1 and A is not null")

(please adjust ranges to your needs)

You can also read more about QUERY


EDIT

Please keep in mind that the example in your question ("So the sheet 'Trial' looks like this... till the end") does NOT match your first paragraph.

If you are really looking for an answer for

...if a cell of a row has a certain string of characters (e.g., it starts with 'blood sample') and collect the rows that match that string.

use the following query

=query('Sheet 01'!A1:B,"where A starts with 'blood sample' and A is not null")

enter image description here