Launched: A new formula to generate a random sample

We get a lot of questions about random samples and how to create them. So we developed a fast, easy trick for you to generate them in Coda.

But first…

A beginner’s guide to sampling

Let’s say you want to survey your customers to understand how you’re currently meeting their needs and how you could do better. The list of customers you can contact for your survey is the sampling frame, but you probably don’t want to contact the entire list. Instead, you’ll want a smaller list, or a sample.

Samples should be randomly selected to ensure everyone from your sampling frame has an equal opportunity of selection. By generating a random sample, you’re minimizing the bias that results from picking a group out of convenience from your sampling frame.

Random samples make it easy to get feedback from a large population for any of the following:

  • Customer satisfaction
  • Market research
  • Healthcare surveys
  • Event planning
  • Branding & brand equity

How to generate a random sample

This can sound daunting, but you don’t actually need to be a data analyst to do this. All you need is a list in a Coda doc!

Just add your sampling frame—your customers—into your list. Once you have your sampling frame, you can easily select a random sample of them with the RandomSample() formula. Follow these steps:

  • Input the formula: RandomSample(list, count, withReplacement=False, updateContinuously=True)
  • Add required inputs
    • list - Choose the list to sample from.
    • count - Choose the size of the sample.
  • Add optional inputs
    • withReplacement - Whether to sample with replacement, which allows for repetition in the sample. This input defaults to false.
    • updateContinously - If this input is true, the output will change on every doc edit. Otherwise, the item will only be generated once. This input defaults to true.

RandomSample() demo.gif

Now that you have a random sample, send them a survey using a Coda form!

For more information on RandomSample() or other Coda formulas, you can visit our formula documentation: Coda | Formula library.


This is great news! I’ve had to put together what I’ve always considered overly complicated tables to generate a random order of a list of names. We use this to scramble the order in which teammates share their daily stand up updates each morning.

indeed an unexpected and nice improvement. I just tested if I could sample a complete list (thus re-order all items) and wrote:

RandomSample([EU Memberstates].[DB Countries].Value,[EU Memberstates].[DB Countries].Count(),True())

this seems to work!


This is a great new formula! Coda does excel in terms of formulas!

Still couldn’t achieve a better logo slider than what we already had simply because of how it looks but I guess I will stick with what I have now.

Thanks for this one!

1 Like

Hey hey! I can finally retire this monstrosity:

Am I missing something or is there not a link to a sample doc that the screenshot example is showing? It would be helpful just to have a direct doc example.