Quickly create lists of numbers or dates - Often seen as unimportant but unlocks great possibilities and automations when handled well

Quickly create lists of numbers or dates - Often seen as unimportant but unlocks great possibilities and automations when handled well

Before everything - What is this formula?

Sequence() allows you create lists of sequential numbers or dates. It defaults to count up by 1, but optionally you can define a by parameter and have it count up at a different rate. Try it out below:

Count to:

00

10

Count by:

0

2

List of Generated Numbers:

13579

First - let’s just learn how it works.

The Sequence() formula is like saying:

Hey Coda, Can you generate a list of numbers for me? Ill just give you a starting point, ending point and occasionally Ill tell you to count up by a number other than 1

Sequence() is a formula that takes the following arguments:

Start

This is the number you will start counting from. Often it will be 1 but it can technically be any number you like

End

This is the number your counted list will end at. Be careful! If you choose 1,000,000 or some wildly huge number it could cause your doc to slow!

By

This is the number your list will count up by. It is an optional argument and defaults to 1 if you do not input anything

Second - Where and how to use this

sequence() can seem slightly useless - or one of the lesser formulas. But to be honest, sequence is likely in my top 10 used formulas. I use it for what I call back-end or automation needs. Here are two examples of where and how I use sequence, but as you play with them yourself you will begin to find a lot more!

Creating a list of dates

In almost all my docs I create a hidden page called Date Controls that holds in it canvas based formulas containing the relative dates of the current week, previous week, current month, and previous month. As an example, here is a canvas based formula for ThisWeek. And here is the formula I wrote to create that list:

Now that I have a list of every date in a week that is named ThisWeek , I can create easy filters or buttons to quickly filter a table to contain only dates from ThisWeek. View my

to see these buttons in action. Each button references a list of dates created by sequence() to quickly filter a table.

Quickly adding rows to a table

Often times I want to quickly add a mass amount of rows to a table. Use cases include:

Create a table with 100 rows or 1000 rows to stress test a document

Create a table with 1 row for every day in the year

Heres and example table with one rows in it. Press each button to see how it automatically adds rows all possible because of sequence (Then click into images below the button to see the formulas I wrote inside these buttons)

Add 25 Rows

Add All Dates from this Month

Reset Table

Quickly Add Rows

Quickly Add Rows

0

Example Power Formula

Warning - Formulas like this are a bit advanced! But shows you what is possible when you start to combine different formulas together.

This formula specifically uses sequence() to search a Random Persons Table, find the ones who are between the ages of 20-29, and then list their info in a digested way for easy viewing.

Sequence Generated Digest

There are 2 people that match the age of 20

@Craig Kidd

@Mr. Brian Montoya

There are no people that match the age of 21

There are 3 people that match the age of 22

@Bryan Johnson

@Jackson Fron

@Angie Collier

There are 3 people that match the age of 23

@Megan Smith

@Daniel Ayers

@Coda Man

There are 3 people that match the age of 24

@Ronnie Gross

@Thomas Ward

@Scott Weir

There is 1 people that match the age of 25

@Elizabeth Nguyen

There is 1 people that match the age of 26

@Angela Hill

There are no people that match the age of 27

There is 1 people that match the age of 28

@Person 2

There is 1 people that match the age of 29

@Matthew Smith

Random Persons Table

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

Name

Age

Name

Age

Craig Kidd

20

Elizabeth Nguyen

25

Ronnie Gross

24

Bryan Johnson

22

Angela Hill

26

Matthew Smith

29

Thomas Ward

24

Megan Smith

23

Mr. Brian Montoya

20

Daniel Ayers

23

Scott Weir

24

Coda Man

23

Jackson Fron

22

Angie Collier

22

Person 5

62

Person 10

31

Person 11

65

Person 2

28

There are no rows in this table

Heres the long formula underneath

Sequence(20, 29) .FormulaMap( WithName( CurrentValue, currentNumber, WithName( [People and Ages] .Filter( currentNumber = Age ), currentMatches, Format( "There {1} people that match the age of {2}{3}", If( currentMatches.Count() = 0, "are no", If( currentMatches.Count() = 1, "is 1", Concatenate("are ", currentMatches.Count()) ) ), currentNumber, If( currentMatches.Count() = 0, "", Concatenate(LineBreak(), currentMatches.BulletedList()) ) ) ) ) ) .NumberedList()