Help

Re: Way to random sort records?

1533 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Bryan_Murley
4 - Data Explorer
4 - Data Explorer

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?

10 Replies 10
Jennifer_Moss
4 - Data Explorer
4 - Data Explorer

I have the same question, thanks!

Ron_Sheridan
5 - Automation Enthusiast
5 - Automation Enthusiast

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

TJ_Zastrow
5 - Automation Enthusiast
5 - Automation Enthusiast

Same here! Random sort please?!

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

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.

Joao_Paulo_Alqu
4 - Data Explorer
4 - Data Explorer

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.

Joachim_Brindea
6 - Interface Innovator
6 - Interface Innovator

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à.