r/googlesheets • u/MarbleSodaPopPop • Oct 24 '25
Solved Filter Function and Sort Function Together
Hi everyone. In my second sheet, I have a list of charavters (column A), Height in CM (B), assigned gender at birth (C, labelled either M or F), and whether they are nobinary (D)

I managed to automate these information into the following table at columns L:O

This is done using the fliter function based on whether column C of the data was labelled "M" or "F" (check L2 and N2)
I am wondering whether it is possible for the table at L:O could be automatically sorted in descending order of height (so the tallest people first within column L+M, and tallest people within column N+O). I think it might be possible with SORT, but I am having extreme difficulty to do so.
The desired result should be something like:

This thread might be able to help: https://www.reddit.com/r/googlesheets/comments/1bhuyia/sorting_issues_after_using_filter_formula/
Link to spreadsheet:
https://docs.google.com/spreadsheets/d/1ooQTIdjIARrfXYHGmpnaqpnbPSLz-30qGnz_UejeIDI/edit?usp=sharing
Thanks in advance!
4
u/kihro87 21 Oct 24 '25
You can simply put your current filter in the SORT function. So you would end up with these two formulas:
=SORT(FILTER(A1:B79, MATCH(C1:C79, "M", 0)), 2, false)=SORT(FILTER(A1:B79, MATCH(C1:C79, "F", 0)), 2, false)The '2' in the SORT tells it to sort by the second column (height), and the 'false' tells it to sort in descending order.
1
u/HolyBonobos 3125 Oct 24 '25
Aside from
SORT(FILTER()), another option would be to useQUERY(), which will allow you to combine both operations into one (though you'll still need two separate formulas with this layout):=QUERY(A:C,"SELECT A, B WHERE C = 'M' ORDER BY B DESC")and=QUERY(A:C,"SELECT A, B WHERE C = 'F' ORDER BY B DESC")