# Combine Sort() statements in one formula?

**URL:** <https://connect.superhuman.com/t/combine-sort-statements-in-one-formula/6957>\
**Category:** Ask the Community\
**Created:** [March 16, 2019, 7:27pm UTC](https://connect.superhuman.com/t/combine-sort-statements-in-one-formula/6957 "2019-03-16T19:27:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ander](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/ander/32/9134_2.png) [@Ander](https://connect.superhuman.com/u/Ander)\
**Post date:** [March 16, 2019, 7:27pm UTC](https://connect.superhuman.com/t/combine-sort-statements-in-one-formula/6957/1 "2019-03-16T19:27:30Z")

</div>

It’s possible to combine `Sort()` statements using the Table UI, and to rearrange them to change sort priority. (see embedded View example)

**Is it also possible to combine** `Sort()` **statements using only a formula?** Chaining `Sort()` performs a total re-sort with each new chain. (see embedded Canvas formula example) This behavior makes sense, but then how to combine `Sort()` statements in a formula?

USE CASE: Organize lengthy list of options in a “Select list”.

* * *

NOTE: My eyes are loving the recently added formula parentheses context shading 😀!  
@alden

* * *
https://coda.io/embed/U_42IgMALZ/_sug1_?viewMode=embedplay

---

<div class="post-metadata">

**Author:** ![Dalmo\_Mendonca](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/dalmo_mendonca/32/5813_2.png) [@Dalmo\_Mendonca](https://connect.superhuman.com/u/Dalmo_Mendonca)\
**Post date:** [March 17, 2019, 10:34pm UTC](https://connect.superhuman.com/t/combine-sort-statements-in-one-formula/6957/2 "2019-03-17T22:34:17Z")

</div>

Hi Ander,

When chaining sorts in formulas, each following sort has precedence over the previous.

So the formula you’re looking for is

`[Sort Formula Combo Test].Sort(true,[Column 3]).Sort(true,[Column 2]).BulletedList()`

This is the opposite of using table sort, where the top criteria have precedence. But the perceived difference is just a visual one.

> [@Ander](#):
>
> Chaining `Sort()` performs a total re-sort with each new chain. (see embedded Canvas formula example)

The next sort works on top of the previous. The result you’ve got is simply because your Column 3 has only unique values.

---

<div class="post-metadata">

**Author:** ![Ander](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/ander/32/9134_2.png) [@Ander](https://connect.superhuman.com/u/Ander)\
**Post date:** [March 17, 2019, 11:35pm UTC](https://connect.superhuman.com/t/combine-sort-statements-in-one-formula/6957/3 "2019-03-17T23:35:44Z")

</div>

Right you are @Dalmo_Mendonca! Thank you!

---

<div class="post-metadata">

**Author:** ![Filmos](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/filmos/32/9322_2.png) [@Filmos](https://connect.superhuman.com/u/Filmos)\
**Post date:** [September 12, 2019, 7:32am UTC](https://connect.superhuman.com/t/combine-sort-statements-in-one-formula/6957/4 "2019-09-12T07:32:32Z")

</div>

In case anyone else finds this topic and is looking for a more optimized (and more complicated) solution, I recommend reading [this post](https://connect.superhuman.com/t/sorting-by-multiple-values/10511/5).
