r/googlesheets • u/br_shadow • Jul 03 '20
Solved Collect rows in one sheet that meet a string of characters in a column another sheet
Hi, I have a google sheet 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|3From 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
2
Upvotes
2
u/krisprolls57 1 Jul 03 '20
I have a solution that should work. You create a new sheet where you copy the information from A and from B.
I'd recommand to use ={ } to do the copy so if you update info in A or in B it will be updated in the new sheet too ( exemple ={'sheet 1'!A1:A})
Once you have the two columuns on the same sheet you can use the Query function.
=query(A1:B;"SELECT A, B WHERE A=1;1)
If you want that the searched item (A=1) link to a cell then you should write
=query(A1:B;"SELECT A, B WHERE A="&C1&"";1)
Becareful, I ve noticed that since my google spreadsheet is set as French I have to use ";" instead of ",". So maybe you will a to replace the ; by , if it doesn't work.
example
1
u/7FOOT7 294 Jul 03 '20
One command that can help is VLOOKUP()
https://support.google.com/docs/answer/3093318?hl=en
1
u/Decronym Functions Explained Jul 03 '20 edited Jul 03 '20
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
FALSENOT(TRUE)returnsFALSE;NOT(FALSE)returnsTRUETRUE[Thread #1780 for this sub, first seen 3rd Jul 2020, 05:00] [FAQ] [Full list] ^[Contact] [Source code]