When working with a data set, you may be looking to pull out a specific subset of it — like the first item of a list, or the last 5 rows of a table. Coda offers *First, Last, Nth, and Slice* formulas to better provide the structure you need for your data set.
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.
Last: Returns the last item from a list or table.
Nth: Returns the Nth item from a list from the number provided.
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)