Mastering Coda's Formulas
Share
Explore

icon picker
Split

A flexible way to gain more control over your data

Before everything - What is this formula?

Split() allows you turn information into lists, or modify how current list items are defined. Try it out below - type in any sentence into the yellow box and watch how it turns your sentence into a list of words.
Sentence
1
Coda is by far the coolest No-Code tool you can ever imagine
There are no rows in this table
List of
12
words:
CodaisbyfarthecoolestNo-Codetoolyoucaneverimagine
List of
60
characters:
Coda is by far the coolest No- Show 30 more
Split() will allow you to take far more control over the data in your documents and do some wildly wonderful things

First - let’s just learn how it works.

The Split() formula is like saying:
Hey Coda, Im going to give you some information - Can you turn it into a list with distinct items?
Split() takes two arguments
Text
This is the text you want to turn into a list
Delimiter
This is the character that defines where/how your text will be split
Here’s some test text:
Coda is a no-code tool that lets you do almost anything
Now define your own delimiter. Try these 5 as an example in the box below:
A blank space (just press the space bar on your keyboard
The letter a
The hyphen symbol: -
The letters cod
The letters Cod
Delimiter:
Output:
Coda is a no-code tool that le Show 25 more
Notice what it is doing. When split() changes text into a list there a couple things to be aware of:
It takes the character and deletes it from the list. When you used the letter a as your delimiter it turned the sentence into a list without any a characters in it whatsoever
Your delimiter is case-sensitive. Cod and cod split your sentence in different ways. If you want to get around this you can use the lower() formula to change everything to lowercase

Second - Where and how to use this

So why is this useful? Lets look at just a couple use-cases

1. Turning a list of text into rows

Sometimes you may want to input a large amount of data into distinct rows. If the incoming data is in an un-friendly format that doesn’t allow you to copy/paste into rows, you can use a combination of split() and formulaMap() to turn that information into rows.

Take for example this list of US States:
Alaska,Alabama,Arkansas,American Samoa,Arizona,California,Colorado,Connecticut,Delaware,Florida,Georgia,Guam,Hawaii,Iowa,Idaho,Illinois,Indiana,Kansas,Kentucky,Louisiana,Massachusetts,Maryland,Maine,Michigan,Minnesota,Missouri,Mississippi,Montana,North Carolina,North Dakota,Nebraska,New Hampshire,New Jersey,New Mexico,Nevada,New York,Ohio,Oklahoma,Oregon,Pennsylvania,Puerto Rico,Rhode Island,South Carolina,South Dakota,Tennessee,Texas,Utah,Virginia,Virgin Islands,Vermont,Washington,Wisconsin,West Virginia,Wyoming
We can turn all that information into rows with the click of a button:
Turn text into Rows
Heres the formula that does it
image.png
State List 2
0

2. Find Word Count

Type in a sentence into the yellow box below and see its word count outputted to the right
Sentence
Word Count
1
This is a sentence with some words in it
You sentence has 9 words
There are no rows in this table

3. Extract First and Last Names

split() is a very handy formula when you want to extract first and last names from a column that contains only full names. There are a couple different ways you can find first and last names. One is simple and will only catch simple cases, and the other is a little more complex but should work in far more cases. But they both use split()
I recommend using the complex way to more reliably catch first-names. Notice how the red row below is an individual with two first names. In cases like this you will need the more complex method.
First and last names
0
Full Name
Simple First
Simple Last
Complex First
Complex Last
1
Scott Weir
Scott
Weir
Scott
Weir
2
Alicia Alvarez Mon-Zeid
Alicia
Mon-Zeid
Alicia Alvarez
Mon-Zeid
3
Luke Skywalker
Luke
Skywalker
Luke
Skywalker
There are no rows in this table

Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.