Skip to main content

Way to random sort records?

  • January 19, 2017
  • 12 replies
  • 148 views

Forum|alt.badge.img+1

Is there a way to sort the records randomly (not alphabetically)? Say I have a table of students and I want them to be randomly ordered for a presentation or something?

12 replies

Forum|alt.badge.img+2
  • New Participant
  • 2 replies
  • January 20, 2017

I have the same question, thanks!


Ron_Sheridan
Forum|alt.badge.img+5
  • New Participant
  • 3 replies
  • March 17, 2017

I also want to be able to do a Random SORT.


  • New Participant
  • 2 replies
  • October 3, 2020

Same here! Random sort please?!


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • October 3, 2020

Back when this question was first asked, this was not possible. It is now possible with scripting. Setup a new number field. Then use scripting to insert a random number in the number field of every record. Finally, sort on the number field.


  • New Participant
  • 2 replies
  • February 11, 2021

Back when this question was first asked, this was not possible. It is now possible with scripting. Setup a new number field. Then use scripting to insert a random number in the number field of every record. Finally, sort on the number field.


Scripting? What would that look like? Random sort is incredibly valuable for memorizing/studying things, but many of us are not computer science people


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • February 11, 2021

Scripting? What would that look like? Random sort is incredibly valuable for memorizing/studying things, but many of us are not computer science people


Welcome to the Airtable community!

Scripting app is an app for Pro plans that lets you run custom JavaScript.

To have a random sort, use a script to fill in a number field with a random number. Then sort on that number field. When you want a new random sort, run the script again.


  • New Participant
  • 2 replies
  • February 11, 2021

Welcome to the Airtable community!

Scripting app is an app for Pro plans that lets you run custom JavaScript.

To have a random sort, use a script to fill in a number field with a random number. Then sort on that number field. When you want a new random sort, run the script again.


Thank you for that explanation. It does sound too complicated for the average user when Airtable could easily add this feature to the “sort” menu or something. I’m imagining the student who wants to review their vocabulary each day. It seems cumbersome to ask them to create a new field and fill it with random numbers and then sort–all before they can start a review of their material. I’ve shared this with the Airtable team, so hopefully they will consider it soon.


Forum|alt.badge.img
  • New Participant
  • 1 reply
  • December 28, 2021

I have been a pro user for quite a long time and it saddends me to realize that a tool I paid for havent the minimum ability to listen to users when regarding to their requests. The solution using “scripting” is not adequate as it requires knowledge from the user and to run the aforementined scripting everytime one needs to list data. So if I have 1000 record that would be 1000 writes and 1000 reads just to get that listing. This could easily be achieved by adding this functionality in the core of the API in the SORT parameter, setting it to “rand” (instead of “asc” or “desc”). Why not prioritize someting that it is in the backlog for FOUR YEARS?


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • December 28, 2021

I have been a pro user for quite a long time and it saddends me to realize that a tool I paid for havent the minimum ability to listen to users when regarding to their requests. The solution using “scripting” is not adequate as it requires knowledge from the user and to run the aforementined scripting everytime one needs to list data. So if I have 1000 record that would be 1000 writes and 1000 reads just to get that listing. This could easily be achieved by adding this functionality in the core of the API in the SORT parameter, setting it to “rand” (instead of “asc” or “desc”). Why not prioritize someting that it is in the backlog for FOUR YEARS?


Welcome to the Airtable community.

You can also use the Batch Update app to set a number field to a random number. Then sort according to that random number. No scripting required.

Airtable tends to not publish why it chooses to not implement the requested feature, but I’m sure they have their reasons. Often something that seems simple from a user point of view is actually fairly complex to implement in the backend at scale.


Forum|alt.badge.img+7

You can never achieve true randomness natively with a formula but here is what I use:

MOD( (FIND("0", RECORD_ID()) * 11.5 + FIND("1", RECORD_ID()) * 23.21 + FIND("2", RECORD_ID()) * 37.12 + FIND("3", RECORD_ID()) * 49.49 + FIND("4", RECORD_ID()) * 59.89 + FIND("5", RECORD_ID()) * 67.52 + FIND("6", RECORD_ID()) * 73.96 + FIND("7", RECORD_ID()) * 89 + FIND("8", RECORD_ID()) * 97.54 + FIND("9", RECORD_ID()) * 101.14 + VALUE(DATETIME_FORMAT(CREATED_TIME(), 'MMDDHHmmssSSS')) * 13.89 + VALUE(DATETIME_FORMAT(LAST_MODIFIED_TIME(), 'MMDDHHmmssSSS')) * 17.25), 1000000 ) + 1

The output is a random number (only a dozen duplicates amongst a list of 10k records in my testings).

I then sort by that column and voilà.


Forum|alt.badge.img+2
  • New Participant
  • 1 reply
  • January 19, 2024

You can never achieve true randomness natively with a formula but here is what I use:

MOD( (FIND("0", RECORD_ID()) * 11.5 + FIND("1", RECORD_ID()) * 23.21 + FIND("2", RECORD_ID()) * 37.12 + FIND("3", RECORD_ID()) * 49.49 + FIND("4", RECORD_ID()) * 59.89 + FIND("5", RECORD_ID()) * 67.52 + FIND("6", RECORD_ID()) * 73.96 + FIND("7", RECORD_ID()) * 89 + FIND("8", RECORD_ID()) * 97.54 + FIND("9", RECORD_ID()) * 101.14 + VALUE(DATETIME_FORMAT(CREATED_TIME(), 'MMDDHHmmssSSS')) * 13.89 + VALUE(DATETIME_FORMAT(LAST_MODIFIED_TIME(), 'MMDDHHmmssSSS')) * 17.25), 1000000 ) + 1

The output is a random number (only a dozen duplicates amongst a list of 10k records in my testings).

I then sort by that column and voilà.


This is a clever solution.  Thanks for sharing.  Unfortunately, my use case requires the field to be randomized upon each page load, rather than one time and then it becomes static.


Cabhorn
Forum|alt.badge.img+6
  • New Participant
  • 4 replies
  • August 3, 2024

Random sort needed! Feature request