# Help With Sorting Please

**URL:** <https://community.glideapps.com/t/help-with-sorting-please/15760>\
**Category:** Ask for Help\
**Created:** [September 14, 2020, 8:01am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760 "2020-09-14T08:01:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [September 14, 2020, 8:01am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/1 "2020-09-14T08:01:26Z")

</div>

Hi. One of my apps keeps a list of tasks. They have a due date and a priority. I want to sort them with those due sooner at the top. However if several tasks have the same due date then those with a higher priority should appear first i.e. a multi-level sort. Ideally I want to do this without using a formula in the Google Sheet since my entire app handles everything in Glide, however building the appropriate “sort key” in a Glide column is causing me an issue. All ideas welcome 😀 😀 😀

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [September 14, 2020, 8:48am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/2 "2020-09-14T08:48:23Z")

</div>

What happens when you make a math column multiplying the date with the priority? I’m just asking how Glide interprets the date in a math and probably I can help a solution.

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [September 14, 2020, 9:05am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/3 "2020-09-14T09:05:04Z")

</div>

Hi @ThinhDinh I will look at the maths. Good idea. But I think it’ll be addition not multiplication. Bear with.

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [September 14, 2020, 9:13am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/4 "2020-09-14T09:13:15Z")

</div>

Alas - date values are seen as 0.00 in a maths column ☹

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [September 14, 2020, 9:19am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/5 "2020-09-14T09:19:57Z")

</div>

Can you try duplicating the column in Sheets using a formula, then format it as a number column?

Addition is the right way here, you’re right. Multiplying two columns together and sort by it should give the right outcome.

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [September 14, 2020, 9:27am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/6 "2020-09-14T09:27:32Z")

</div>

Then it gives some “crazy” numbers that look like they’re based on the “char values” of the textual representation of the date. Looks as though I may have to revert to the Google Sheet and an array column. I hate that.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [September 14, 2020, 10:01am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/7 "2020-09-14T10:01:55Z")

</div>

You just need an arrayformula to duplicate the date in the Sheets, then the rest can happen in Glide I imagine.

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [September 14, 2020, 10:21am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/8 "2020-09-14T10:21:47Z")

</div>

Yup. That’s exactly it. In the Google Sheet I create a “Sort Key” string which is YYYY + MM + DD + “0” or “1” based on priority. Then sort on that inside Glide. It works but a shame 😑

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [September 14, 2020, 10:47am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/9 "2020-09-14T10:47:46Z")

</div>

Can you try formatting the date in the Sheets in the original column as yyyy/mm/dd then combine it with the priority in a template column inside Glide? I think it would be the same, albeit you need to forfeit whatever format you used to display the date before.

---

<div class="post-metadata">

**Author:** ![sardamit](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sardamit/32/263_2.png) [@sardamit](https://community.glideapps.com/u/sardamit)\
**Post date:** [September 14, 2020, 11:41am UTC](https://community.glideapps.com/t/help-with-sorting-please/15760/10 "2020-09-14T11:41:44Z")

</div>

- Create a copy of the date column in GS.
- Change the data type of the new date column to a numeric value.
- Assign a number to the priority: High - 3, Medium - 2, Low - 1.
- Concatenate Priority and Numeric Date value with a hyphen in between using the Template column.
- Use this new field to sort.

In theory, this works. In practice, let us know if it works. 🙂
