Forum Discussion
lddbs
Jun 17, 2024Copper Contributor
sort(), filter() and IF() combined
I have a formula: =SORT(IF(AX2 = "1+1"; FILTER(A2:J200; E2:E200 >= MAX(P:P)); 1; 1); FILTER(A2:J200; E2:E200 >= INDEX(P2:P200; X4-1)); 1; 1) I want to sort a column by a condition statement. For e...
Riny_van_Eekelen
Jun 17, 2024Platinum Contributor
lddbs Can't really tell what result you expect, but the following formula will return a result. That is, it's a formula with the correct syntax and will not return an error. Up to you to decide if the result is correct or not. If not, please clarify by showing the underlying data and expected result.
=SORT(IF(AX2 = "1+1"; FILTER(A2:J200; E2:E200 >= MAX(P:P)); FILTER(A2:J200; E2:E200 >= INDEX(P2:P200; X4-1)));1;1)
The IF statement determines which filter will be applied. Then SORT will sort the outcome of the applied filter by the first column in ascending order.