# List Sorting Help

**URL:** <https://community.glideapps.com/t/list-sorting-help/65905>\
**Category:** Ask for Help\
**Created:** [September 8, 2023, 7:06am UTC](https://community.glideapps.com/t/list-sorting-help/65905 "2023-09-08T07:06:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cameraville](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/cameraville/32/60231_2.png) [@Cameraville](https://community.glideapps.com/u/Cameraville)\
**Post date:** [September 8, 2023, 7:06am UTC](https://community.glideapps.com/t/list-sorting-help/65905/1 "2023-09-08T07:06:16Z")

</div>

I have a large list of things produced, including their year and the serial start start and serial number end produced on each occasion. How can I display them in a sort order where years are first priority, then the serial number start?

For example I want row 8 to come before row 5, because obviously “58” come before “151” when looking at these numbers as a human.

 ![Screenshot 2023-09-08 at 9.56.31](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/a/8a983e84de7ca597f61b78772c3bca4a3a2bcd0e.jpeg)

Currently I am sorting by template column of Year and Serial Start.

 ![Screenshot 2023-09-08 at 10.04.19](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/0/70ab9c6188b485809e143e55ae77afd804211d75.png)

I tried to make these two figures as an array, thinking it would look at the number as a whole and not one digit at a time, but I cannot sort by an array.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 8, 2023, 7:20am UTC](https://community.glideapps.com/t/list-sorting-help/65905/2 "2023-09-08T07:20:17Z")

</div>

What I would do is split out the first serial number using an Extract Matching Text column, and then use that with the year in a math column to compute a single integer value to use for sorting.

Using the data shown in your screen shot:

 ![CleanShot 2023-09-08 at 15.14.36@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/7/c7c18921130ab511a0a50948b1bab1375d85a48e.png)

To extract the first serial number:

 ![CleanShot 2023-09-08 at 15.16.22@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/6/c60edd0193b5e6e9dad6824d5f182eb4d7ff1f0d.png)

And the Math column:

```auto
Year*10^4+First

```

 ![CleanShot 2023-09-08 at 15.16.41@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/9/199c11fd29e7b3d97c117c4a5020781e0e6187ce.png)

Note that the formula would need to be adjusted based on the maximum number of digits in your serial numbers. For example, if the serial numbers had a maximum of 6 digits (which appears to be the case from your second screen shot), then you would use `10^7`

---

<div class="post-metadata">

**Author:** ![Cameraville](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/cameraville/32/60231_2.png) [@Cameraville](https://community.glideapps.com/u/Cameraville)\
**Post date:** [September 9, 2023, 5:18am UTC](https://community.glideapps.com/t/list-sorting-help/65905/3 "2023-09-09T05:18:41Z")

</div>

> [@Darren\_Murphy](#):
>
> `Year*10^4+First`

Yes - this worked perfectly. Thank you so much. I have up to 8 digit numbers so I adjusted accordingly, and luckily I already had the start year as it own field - no need for extraction! I appreciate the answer

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [September 16, 2023, 5:19am UTC](https://community.glideapps.com/t/list-sorting-help/65905/4 "2023-09-16T05:19:05Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
