All Collections
Specific formulas
First, Last, Nth, and Slice
First, Last, Nth, and Slice

Working with lists in the formula language

Updated over a week ago
<a href="mailto:Coda_Symbol-Tomato_Soup@4x.png" target="_blank" rel="nofollow noopener noreferrer">Coda_Symbol-Tomato_Soup@4x.png</a>

When working with a data set, you may be looking to pull out a specific subset of your data — like the first item of a list, or the last 5 rows of a table. To allow you to extract the subset of the data that you need, Coda offers the First( ), Last( ), Nth( ), and Slice( ) formulas.

Our example uses a simple list of numbers: [1, 3, 5, 7, 11, 13]. These formulas allow specific items from the list to be filtered based on their position.

How to use formulas

First( ): Returns the first item from a list or table.


Output: 1

Last( ): Returns the last item from a list or table.


Output: 13

Nth( ): Returns the Nth item from a list from the number provided.


Output: 11

Slice( ): Returns the part of the provided text or list based on the numerical position.


Output: [3, 5, 7]

Table of Definitions

Ways to use Slice

With Slice( ) in particular, there are a few different varieties you can try:

  • Give me the first 3:  


  • Or, give me the last 2:


  • And even, pull out specific rows:

I'm working with the Urgent Open Tasks table in our Product Launch Hub, and I wanted to get the last 3 rows of this table which are sorted by their End Date:

Using Slice, I'm able to build it into the core project table: 

=[Urgent Open Tasks !!].Sort(True, End).Slice(-3)

Coda Tips!

Did this answer your question?