Share via

Add Sort Function to Existing formula

Anonymous
2023-05-23T17:34:30+00:00

I have the following formula and would like to add the sort function so results are listed for column tblConsumerList[Date Services Ceased] in descending order. I just don't know where to plug it into the equation.

=

IF(F2="All",CHOOSECOLS(FILTER(tblConsumerList,tblConsumerList[Receiving Services]="No"),1,21,22),CHOOSECOLS(FILTER(tblConsumerList,tblConsumerList[Reason, If not receiving service]=F2),1,21,22))
Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2023-05-23T17:48:50+00:00

If Date Services Ceased is in column 21 Use 2.

=SORT(IF(F2="All",CHOOSECOLS(FILTER(tblConsumerList,tblConsumerList[Receiving Services]="No"),1,21,22),CHOOSECOLS(FILTER(tblConsumerList,tblConsumerList[Reason, If not receiving service]=F2),1,21,22)),2,-1,)

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. HansV 462.6K Reputation points
    2023-05-23T17:53:31+00:00

    Assuming that you want to sort of the first selected column:

    =SORT(CHOOSECOLS(FILTER(tblConsumerList, IF(F2="All",tblConsumerList[Receiving Services]="No", tblConsumerList[Reason, If not receiving service]=F2),1,21,22)), 1, -1)

    Change the 1 near the end to 2 or 3 to sort on the 2nd or 3rd column.

    (I shortened the formula slightly)

    Was this answer helpful?

    0 comments No comments