Formulas

Collections

Count(list)

Copy link

Counts the size of a list

Planets.Count()
8
Planets.Filter(Moons.Count() > 1)
[Mars, Jupiter, Saturn, Uranus, Neptune]

Inputs

list...
A table, column, or list of values

Output

Outputs the count of non-blank values in list(s).

CountUnique(value)

Copy link

Counts number of unique values

CountUnique(1, 2, 3, 3, 3, 4)
4

Inputs

value...
A value or list of values to be counted

Output

Outputs a count of all of the unique value(s) ignoring duplicates and blank values. Counts each unique item in a value if it is a list.

Find(needle, haystack, startAt, ignoreCase, ignoreAccents)

Copy link

Get the position of a value

Find("world", "hello world")
7
Find("world", "Hello World", 0, true)
7
Find("varlden", "hej världen", 0, false, true)
5
Find(1, List(2, 4, 6))
-1
Find("be", List("to", "be", "or", "not", "to", "be"), 3)
6

Required inputs

needle
A value you wish to find
haystack
A string or list you want to find the needle in

Optional inputs

startAt
The position to search from. Counts from 1 (default)
ignoreCase
Whether to ignore case when searching text. Defaults to false.
ignoreAccents
Whether to ignore diacritics (accents, umlauts, cedillas, etc.) when searching text. Defaults to false.

Output

Outputs the first position of needle in haystack starting at startAt, or -1 if not found. Works with text and lists.

MaxBy(list, compareBy)

Copy link

Get the row of a table with the maximum value in the provided column, or item in a list with the maximum value by the provided formula.

Planets.MaxBy(Diameter)
Jupiter
List(3, 5, 7).MaxBy(CurrentValue % 6)
5

Inputs

list
A table, column, or list of values
compareBy
A formula to evaluate for each item and compare by. This can be a column if list is a table and can reference CurrentValue.

Output

Outputs the maximum item inlist based on evaluating compareBy over each item. This will return the item in the original list, not the value that is used for comparison - use Max(list.compareBy) instead to only fetch the maximum compared value.

MinBy(list, compareBy)

Copy link

Get the row of a table with the minimum value in the provided column, or item in a list with the minimum value by the provided formula.

Planets.MinBy(Diameter)
Mercury
List(3, 5, 7).MinBy(CurrentValue % 6)
7

Inputs

list
A table, column, or list of values
compareBy
A formula to evaluate for each item and compare by. This can be a column if list is a table and can reference CurrentValue.

Output

Outputs the minimum item in list based on evaluating compareBy over each item. This will return the item in the original list, not the value that is used for comparison - use Min(list.compareBy) instead to only fetch the minimum compared value.

Slice(value, start, end)

Copy link

Get part of a list or text

Slice("Hello world", 5, 9)
o wor
List("Cat", "Dog", "Mouse").Slice(2, 3)
[Dog, Mouse]

Required inputs

value
A text string or list of values
start
The position to start from. Counts from 1

Optional inputs

end
The position to end at. Counts from 1

Output

Outputs a part of the provided value based on the start and end positions.

Sort(dataset, ascending, sortBy, sortByCount)

Copy link

Sort a list or column

List(1, 5, 3, 4, 2).Sort()
[1, 2, 3, 4, 5]
Planets.Sort(false, Diameter)
[Jupiter, Saturn, Uranus, Neptune, Earth, Venus, Mars, Mercury]

Required inputs

dataset
A list or column to be sorted

Optional inputs

ascending
True for ascending or False for descending. Defaults to True.
sortBy
The property of dataset to sort on. Can only be specified if each item in dataset is a row or an object.
sortByCount
True to order elements by count or False to order elements by value. Defaults to False.

Output

Outputs dataset in sorted order. Sort order and criteria are specified by the ascending, sortBy and sortByCount inputs.

Splice(value, start, deleteCount, insertValue)

Copy link

Remove and add to a list or text

Splice(List(1, 2, 3, 4, 5), 2, 3, List("Dog", "Cat"))
[1, Dog, Cat, 5]

Inputs

value
A list or text to modify
start
The position to start from. Counts from 1
deleteCount
The number of items or characters to delete
insertValue...
The value, text, or list of values to insert

Output

Outputs value with deleteCount values removed and insertValue(s) added at start position.

Dates

Created(object)

Copy link

Get the created date/time for a row or other object

ExampleTable.Created()
3/8/2017 9:23:18 AM

Inputs

object
A Coda object. This includes tables, views, columns, rows, and docs.

Output

Outputs the created date/time for object.

CurrentTimezone()

Copy link

Get the user's current time zone

CurrentTimezone()
{timezone: "Pacific/Honolulu", offset: -10}

Output

Outputs the user's current time zone.

Date(year, month, day)

Copy link

Create a date value

Date(1985, 1, 4)
1/4/1985
Date(2019, 2, 5)
2/5/2019

Inputs

year
The year as a number
month
The month as a number
day
The day as a number

Output

Outputs the date of the provided year, month, and day.

DateTime(year, month, day, hour, minute, second)

Copy link

Create a date time value

DateTime(1985, 1, 4, 10, 30)
1/4/1985 10:30 AM
Date(2019, 2, 5, 17, 30, 30)
2/5/2019 5:30:30 PM

Required inputs

year
The year as a number
month
The month as a number
day
The day as a number

Optional inputs

hour
The hour as a number
minute
The minute as a number
second
The second as a number

Output

Outputs the date of the provided year, month, day, hour, minute, and second.

DateTimeTruncate(dateOrTime, unit)

Copy link

Round a date/time

Time(1, 30, 45).DateTimeTruncate("minute")
1:30 AM
DateTime(2023, 4, 28, 1, 30, 45).DateTimeTruncate("hour")
4/28/2023 1:00 AM

Inputs

dateOrTime
A time or date/time
unit
The unit to round to. Can be "year", "quarter", "month", "week", "day", "hour", "minute" or "second".

Output

Outputs dateOrTime rounded to the nearest unit.

DateToEpoch(date)

Copy link

Convert date to epoch

DateToEpoch("3/10/2017 3:14:24 PM")
1489187664

Inputs

date
The date to convert

Output

Outputs date as an epoch time (the number of seconds since Jan 1st, 1970).

Day(dateTime)

Copy link

Get the day-of-month from a date/time

Day(Date(2013, 4, 18))
18

Inputs

dateTime
A date/time

Output

Outputs the day of month of the given dateTime as a number.

DocumentTimezone()

Copy link

Get the document's timezone

DocumentTimezone()
{timezone: "America/Los_Angeles", offset: -7}

Output

Outputs the document's timezone.

EndOfMonth(dateTime, monthOffset)

Copy link

Get the last day of a given month

EndOfMonth(Today(), 3)
6/30/2017
EndOfMonth(Date(2017, 03, 20), 1)
4/30/2017

Inputs

dateTime
A date/time
monthOffset
The number of months to move forward or backwards. 0 is month of dateTime. 1 is the following month, -1 is the previous month.

Output

Outputs the date for the last day of the month of dateTime plus monthOffset.

EpochToDate(epochTime)

Copy link

Convert epoch time to date

EpochToDate(1489187664)
3/10/2017 3:14:24 PM

Inputs

epochTime
The number of seconds since Jan 1st, 1970

Output

Outputs epochTime as a date.

Hour(dateOrTime)

Copy link

Get the hour from a date/time

Hour(DateTime(1985, 1, 4, 10, 30))
10
Hour(Time(1, 30, 45))
1

Inputs

dateOrTime
A time or date/time

Output

Outputs the hour of the given dateOrTime as a number.

IsoWeekNumber(dateTime)

Copy link

Get the week number of a date in the ISO week numbering system, where week 1 contains the first Thursday of the year and weeks start on Monday

IsoWeekNumber(Date(2019, 2, 5))
6

Inputs

dateTime
A date/time

Output

Outputs the week of dateTime as a number between 1 and 52.

IsoWeekday(dateTime)

Copy link

Get the day-of-week of a date/time as a number in the ISO week numbering system, where Monday is 1.

IsoWeekday(Date(2019, 2, 5))
2

Inputs

dateTime
A date/time

Output

Outputs the day-of-week of dateTime as a number between 1 and 7.

Minute(dateOrTime)

Copy link

Get the minute from a date/time

Hour(DateTime(1985, 1, 4, 10, 30))
30
Minute(Time(1, 30, 45))
30

Inputs

dateOrTime
A time or date/time

Output

Outputs the minute of the given dateOrTime as a number.

Modified(object)

Copy link

Get the modified date/time for a row or other object

Table.Modified()
3/10/2017 8:56:23 AM

Inputs

object
A Coda object. This includes tables, views, columns, rows, and docs.

Output

Outputs the modified date/time for object.

Month(dateTime)

Copy link

Get the month from a date

Month(Date(2013, 4, 18))
4

Inputs

dateTime
A date/time

Output

Outputs the month of the given dateTime as a number.

MonthName(dateTime, format)

Copy link

Get the month name for a date

MonthName(Date(2013, 4, 18))
April

Required inputs

dateTime
A date/time

Optional inputs

format
Use "MMM" for appreviated month name, or "MMMM" for full month name.

Output

Outputs the month name for given dateTime as text.

NetWorkingDays(startDate, endDate, holidays)

Copy link

Count working days between dates. Customize working days in region and date settings.

NetWorkingDays(Date(2016, 2, 1), Date(2016, 2, 3))
3

Required inputs

startDate
The date to count from
endDate
The date to count to

Optional inputs

holidays
A list of dates to exclude from the count (e.g. holidays)

Output

Outputs the count of working days between startDate and endDate excluding holidays. Customize working days in region and date settings.

Now(precision)

Copy link

Get the current date/time

Now()
3/10/2017 8:56:23 AM

Optional inputs

precision
The precision of the time returned. Valid options are "second" (default), "minute", "hour", and "day", as well as their plural equivalents.

Output

Outputs the current date and time. Updates based on precision specified.

RelativeDate(dateTime, months)

Copy link

Add months to a date/time

RelativeDate(Date(2016, 1, 1), 2)
3/1/2016

Inputs

dateTime
A date/time
months
Months to add (can be negative)

Output

Outputs months added to dateTime rounded to the day.

Second(dateOrTime)

Copy link

Get the "second" from a date/time

Hour(DateTime(1985, 1, 4, 10, 30, 50))
50
Second(Time(1, 30, 45))
45

Inputs

dateOrTime
A time or date/time

Output

Outputs the seconds part of the given dateOrTime as a number.

Time(hour, minute, second)

Copy link

Create a time value

Time(1, 30, 45)
1:30:45 AM
Time(17, 0, 0)
5:00 PM

Inputs

hour
The hour as a number
minute
The minute as a number
second
The second as a number

Output

Outputs the time of the provided hour, minute, and second.

TimeValue(time)

Copy link

Convert a time to a number

TimeValue("5:30:18 PM")
0.729375

Inputs

time
A time or date/time

Output

Outputs time as a decimal ratio of the day.

ToDate(text)

Copy link

Convert text into a date value. Respects the doc's date order setting.

ToDate("2013-03-14")
3/14/2013

Inputs

text
Text in a recognized date format such as "MM-DD-YY" or "YYYY/MM/DD"

Output

Outputs the value of text parsed into a date. Outputs blank if text can't be parsed.

ToDateTime(datetime)

Copy link

Converts text into a date/time. Respects the doc's date order setting.

ToDateTime("2013-03-14 18:13:23")
3/14/2013 6:13:23 PM

Inputs

datetime
Text in a recognized date format such as "MM-DD-YY HH:MM:SS"

Output

Outputs the value of datetime parsed into a date and time. Outputs blank if datetimecan't be parsed.

ToTime(value)

Copy link

Converts a value into a time

ToTime("5:30:18 PM")
5:30:18 PM
ToDateTime("2013-03-14 18:13:23").ToTime()
6:13:23 PM

Inputs

value
A value to convert

Output

Outputs the value of value parsed into a time. Outputs blank if valuecan't be parsed.

Today()

Copy link

Get today's date

Today()
3/8/2017
Today() + Days(14)
3/22/2017

Output

Outputs the current date. Updates daily.

WeekNumber(dateTime, returnType)

Copy link

Get the week number of a date, where week 1 contains Jan 1. Respects the doc’s first day of week setting. Use "IsoWeekNumber()" if week 1 should contain the first Thursday of the year.

WeekNumber(Date(2019, 2, 5))
6

Required inputs

dateTime
A date/time

Optional inputs

returnType
Currently unused parameter

Output

Outputs the week of dateTime as a number between 1 and 52.

Weekday(dateTime, returnType)

Copy link

Get the day-of-week of a date/time as a number. Respects the doc’s first day of week setting.

Weekday(Date(2019, 2, 5))
3

Required inputs

dateTime
A date/time

Optional inputs

returnType
Currently unused parameter

Output

Outputs the day-of-week of dateTime as a number between 1 and 7.

WeekdayName(dateTime)

Copy link

Get the day-of-week of a date as text

WeekdayName(Date(2019, 2, 5))
Tuesday

Inputs

dateTime
A date/time

Output

Outputs the day-of-week of dateTime as text ("Monday", "Tuesday", etc.).

Workday(startDate, numWorkingDays, holidays)

Copy link

Adds working days to a date. Customize working days in region and date settings.

Workday(Date(2016, 2, 1), 5)
2/8/2016

Required inputs

startDate
The date to count from
numWorkingDays
Number of working days to move the date forward. Customize working days in region and date settings.

Optional inputs

holidays
A list of dates to exclude from the count (e.g. holidays)

Output

Outputs a date based on your startDate plus the numWorkingDays you wish to move forward skipping over any dates included in holidays.

Year(dateTime)

Copy link

Get the year of a date

Year(Date(2019, 2, 5))
2019

Inputs

dateTime
A date/time

Output

Outputs the year of the given dateTime as a number.

Duration

Days(days)

Copy link

Create a time duration (for days)

Days(14)
14 days
Date(2019, 2, 5) + Days(7)
2/12/2019

Inputs

days
The number of days

Output

Outputs a time duration for the specified number of days.

Duration(days, hours, minutes, seconds)

Copy link

Create a time duration

Duration(4, 3, 2, 1)
4 days 3 hrs 2 mins 1 sec

Optional inputs

days
The number of days
hours
The number of hours
minutes
The number of minutes
seconds
The number of seconds

Output

Outputs a time duration for the specified number of days, hours, minutes, and seconds.

Hours(hours)

Copy link

Create a time duration (for hours)

Hours(12)
12 hrs
Hours(36)
1 day 12 hours

Inputs

hours
The number of hours

Output

Outputs a time duration for the specified number of hours.

Minutes(minutes)

Copy link

Create a time duration (for minutes)

Minutes(3)
3 min
Minutes(84)
1 hour 24 mins

Inputs

minutes
The number of minutes

Output

Outputs a time duration for the specified number of minutes.

Seconds(seconds)

Copy link

Create a time duration (for seconds)

Seconds(38)
38 seconds
Seconds(80)
1 min 20 seconds

Inputs

seconds
The number of seconds

Output

Outputs a time duration for the specified number of seconds.

ToDays(duration)

Copy link

Convert a time duration into a number of days

ToDays(Hours(12))
0.5
ToDays(Duration(days: 1, hours: 6))
1.25

Inputs

duration
The time duration to convert

Output

Outputs a number of days for the specified duration.

ToHours(duration)

Copy link

Convert a time duration into a number of hours

ToHours(Minutes(120))
2
ToHours(Duration(days: 1, hours: 6))
30

Inputs

duration
The time duration to convert

Output

Outputs a number of hours for the specified duration.

ToMinutes(duration)

Copy link

Convert a time duration into a number of minutes

ToMinutes(Seconds(120))
2
ToMinutes(Duration(days: 1, hours: 6))
1800

Inputs

duration
The time duration to convert

Output

Outputs a number of minutes for the specified duration.

ToSeconds(duration)

Copy link

Convert a time duration into a number of seconds

ToSeconds(Minutes(120))
7200
ToSeconds(Duration(days: 1, hours: 6))
108000

Inputs

duration
The time duration to convert

Output

Outputs a number of seconds for the specified duration.

Filters

AverageIf(list, expression)

Copy link

Compute the average of a filtered list of numbers

List(1,2,3,4).AverageIf(CurrentValue > 2)
3.5

Inputs

list
List of numbers or number column
expression
A formula returning a boolean value (true or false). Use "currentValue" to reference the current item in the list. When filtering a table, "currentValue" will refer to a row.

Output

Outputs the average of a list of numbers for values matching expression. Blank values are ignored.

CountIf(list, expression)

Copy link

Get the count for a filtered list

Planets.CountIf(Moons.Count() > 1)
5
CountIf(List(1,2,3,4), CurrentValue > 2)
2

Inputs

list
A table, column, or list of values
expression
A formula returning a boolean value (true or false). Use "currentValue" to reference the current item in the list. When filtering a table, "currentValue" will refer to a row.

Output

Outputs the count of values in list for values matching expression. Blank values are ignored.

Filter(list, expression)

Copy link

Gets a list of values that match your filter

Fruits.Filter(Color = "Green")
[@Lime, @Kiwi, @Honeydew]
List(1,2,3,4).Filter(CurrentValue > 2)
[3, 4]

Inputs

list
A table, column, or list of values
expression
A formula returning a boolean value (true or false). Use "currentValue" to reference the current item in the list. When filtering a table, "currentValue" will refer to a row.

Output

Outputs a list of all values in list that match expression.

IsFromTable(row, table)

Copy link

Check if a reference is from a table

IsFromTable(@Bill Clinton, [Presidents])
true

Inputs

row
The row to check
table
The table to search

Output

Outputs True if row is a row in table. Otherwise outputs False.

Lookup(table, column, match value)

Copy link

Get the rows from a table that match your filter

Lookup(Tasks, Project, thisRow)
[@Get estimate, @Schedule work, @Get permit]
Lookup(Tasks, Status, "Not Started")
[@Schedule work, @Get permit]

Inputs

table
The table to get rows from
column
The column to search in table
match value
The value to search for in column

Output

Outputs the rows from a table where column is the same as match value. We recommend using Table.Filter() instead.

Matches(value, control)

Copy link

Checks if a Coda control matches a value

[Color Column].Matches([Color Select Control])
true

Inputs

value
A value to check against the control
control
A control to check against the value

Output

Outputs True if the given value matches the control. Otherwise outputs False.

SumIf(list, expression)

Copy link

Compute the sum for a filtered list

List(1,2,3,4).SumIf(CurrentValue > 2)
7

Inputs

list
List of numbers or number column
expression
A formula returning a boolean value (true or false). Use "currentValue" to reference the current item in the list. When filtering a table, "currentValue" will refer to a row.

Output

Outputs the sum of a list of numbers for values matching expression. Blank values are ignored.

Info

IsAnyText(value)

Copy link

Checks if a value is plain text or rich text

IsAnyText("Hello world")
true
IsAnyText(BulletedList(List("Hello", "world")))
true
IsAnyText(14)
false

Inputs

value
A value to check

Output

Outputs True if the given value is plain text or rich text. Otherwise, outputs False.

IsBlank(value)

Copy link

Check if a value is blank

IsBlank("")
true
IsBlank("Hello world")
false

Inputs

value
A value to check

Output

Outputs True if the given value is blank. Otherwise, outputs False.

IsDate(value)

Copy link

Checks if a value is a date

IsDate("2014-01-1")
true
IsDate("Hello world")
false

Inputs

value
A value to check

Output

Outputs True if the given value is a date. Otherwise, outputs False.

IsLogical(value)

Copy link

Checks if a value is true or false

IsLogical(True)
true
IsLogical("Hello world")
false

Inputs

value
A value to check

Output

Outputs True if the given value is True or False. Outputs False if it's neither.

IsNotBlank(value)

Copy link

Checks if a value is not blank

IsNotBlank("")
false
IsNotBlank("Hello world")
true

Inputs

value
A value to check

Output

Outputs True if the given value is not blank. Otherwise, outputs False.

IsNotText(value)

Copy link

Checks if a value is not text

IsNotText(14)
true
IsNotText("Hello world")
false

Inputs

value
A value to check

Output

Outputs True if the given value is not blank. Otherwise, outputs False.

IsNumber(value)

Copy link

Checks if a value is a number

IsNumber(14)
true
IsNumber("Hello world")
false

Inputs

value
A value to check

Output

Outputs True if the given value is a number. Otherwise, outputs False.

IsPlainText(value)

Copy link

Checks if a value is plain text

IsPlainText("Hello world")
true
IsPlainText(14)
false

Inputs

value
A value to check

Output

Outputs True if the given value is plain text. Otherwise, outputs False. Will output False if value is rich text.

IsRichText(value)

Copy link

Checks if a value is rich text

IsRichText(BulletedList(List("Hello", "world")))
true
IsRichText("Hello world")
false

Inputs

value
A value to check

Output

Outputs True if the given value is rich text. Otherwise, outputs False. Will output False if value is plain text.

ToNumber(value, base)

Copy link

Convert a value to a number

ToNumber("134")
134
ToNumber("FF", 16)
255

Required inputs

value
A value to convert

Optional inputs

base
The base or radix used to parse value. Defaults to 10.

Output

Outputs value as a number if conversion with base is possible. Otherwise outputs value.

ToText(value)

Copy link

Convert a value to text

ToText(11431)
"11431"

Inputs

value
A value to convert

Output

Outputs value as text.

Lists

All(list, expression)

Copy link

Checks if an expression evaluates to true for all values in a list

List(1, 2, 3).All(CurrentValue > 2)
false
[Table 1].Status.All(CurrentValue = "Is Done")
true

Required inputs

list
A table, column, or list of values

Optional inputs

expression
A formula returning a boolean value (true or false). Defaults to `CurrentValue`.

Output

Outputs True if the result for evaluating expression on every value in list is true.

Any(list, expression)

Copy link

Checks if an expression evaluates to true for any value in a list

List(1, 2, 3).Any(CurrentValue > 2)
true
[Table 1].Owner.Any(CurrentValue = User())
false

Required inputs

list
A table, column, or list of values

Optional inputs

expression
A formula returning a boolean value (true or false). Defaults to `CurrentValue`.

Output

Outputs True if the result for evaluating expression on any value in list is true.

Contains(value, search)

Copy link

Checks if a list contains any value from a list

Contains("Dog", "Cat", "Mouse")
False
Contains("Dog", "Cat", "Mouse", "Dog")
True
List("Dog", "Giraffe").Contains("Cat", "Mouse", "Dog")
True

Inputs

value
A value or list of values to search in
search...
A value or list of values to search for

Output

Outputs True if any value in search exists in value.

ContainsAll(value, search)

Copy link

Checks if a list contains all values from a list

ContainsAll("Dog", "Cat", "Mouse")
False
ContainsAll(List("Cat", "Rabbit"), "Cat", "Mouse")
False
List("Cat", "Mouse", "Rabbit").ContainsAll(List("Cat", "Mouse"))
True

Inputs

value
A value or list of values to search in
search...
A value or list of values to search for

Output

Outputs True if all values in search exists in value.

ContainsOnly(value, search)

Copy link

Checks if a list contains only values from a list

ContainsOnly("Dog", List("Dog", "Mouse"))
False
List("Dog", "Mouse", "Cat").ContainsOnly("Cat", "Mouse")
False
List("Dog", "Mouse").ContainsOnly("Mouse", "Dog")
True
ContainsOnly(List("Dog", "Dog"), "Dog")
True

Inputs

value
A value or list of values to search in
search...
A value or list of values to search for

Output

Outputs True if only values in search exist in value.

CountAll(list)

Copy link

Counts the size of a list including blank values

Planets.CountAll()
8
List("a", "b", "").CountAll()
3

Inputs

list
A table, column, or list of values

Output

Outputs the count of values in list, including blank values.

Duplicates(value)

Copy link

Get duplicate values

List("Dog", "Dog", "Cat", "Mouse", "Cat").Duplicates()
[Dog, Cat]
List(1, 2, 3).Duplicates()
[]

Inputs

value...
A value to check for duplication

Output

Outputs a list of values which appear multiple times.

First(list)

Copy link

Get the first value from a list

List(1, 3, 5, 7, 11, 13).First()
1

Inputs

list
A table, column, or list of values

Output

Outputs the first value in list or blank if the list is empty.

ForEach(list, formula)

Copy link

Run a formula for every item in a list

List("Dog", "Cat").ForEach(Upper(CurrentValue))
[DOG, CAT]

Inputs

list
A table, column, or list of values
formula
A formula to evaluate for each item. Can reference CurrentValue.

Output

Evaluates formula for every value in list and outputs a list of all formula outputs.

FormulaMap(list, formula)

Copy link

Run a formula for every item in a list

List("Dog", "Cat").FormulaMap(Upper(CurrentValue))
[DOG, CAT]

Inputs

list
A table, column, or list of values
formula
A formula to evaluate for each item. Can reference CurrentValue.

Output

Evaluates formula for every value in list and outputs a list of all formula outputs.

In(search, value)

Copy link

Checks if a value is in a list

In("Dog", "Cat", "Mouse")
False
In("Dog", "Cat", "Mouse", "Dog")
True

Inputs

search
A value to search for
value...
A value or list of values to search in

Output

Outputs True if search is found in value.

Last(list)

Copy link

Get the last value from a list

List(1, 3, 5, 7, 11, 13).Last()
13

Inputs

list
A table, column, or list of values

Output

Outputs the last value in list or blank if the list is empty.

List(value)

Copy link

Make a list of values

List(1, 3, 5, 7, 11, 13)
[1,3,5,7,11,13]
List("Dog", "Cat", "Mouse").NTH(2)
"Cat"

Inputs

value...
A value or list of values to include in the list

Output

Outputs a list of value(s) or an empty list if no value is provided.

ListCombine(value)

Copy link

Merge and flatten lists

ListCombine(List(1, 2, 3), 4, 5, 6)
[1,2,3,4,5,6]
ListCombine(List(1, 2, 3), List(4, 5), 6)
[1,2,3,4,5,6]

Inputs

value...
A value or list of values to include in the combined list

Output

Outputs a list of all value(s). Nested lists are flattened in the output.

Nth(list, position)

Copy link

Returns the nth item in a list from the number provided

List(1,3,5,7,11).Nth(1)
1
List("Dog", "Cat", "Mouse").Nth(3)
"Mouse"

Inputs

list
A table, column, or list of values
position
The position to retrieve a value for. The first item in the list has index 1.

Output

Outputs the value from list at position. Results in an error if position is outside of list.

RandomItem(list, updateContinuously)

Copy link

Select a random item from a list

RandomItem(List(1,2,3))
2

Required inputs

list
A table, column, or list of values

Optional inputs

updateContinuously
If True the output will change on every doc edit. Otherwise, the number will only be generated once. Defaults to True.

Output

Outputs a random item from list. Regenerates on every edit by default.

RandomSample(list, count, withReplacement, updateContinuously)

Copy link

Generate a random sample of items from a list

RandomSample(Sequence(1, 10), 3)
[8, 2, 7]
RandomSample(Sequence(1, 10), 5, True)
[9, 2, 3, 6, 2]

Required inputs

list
A table, column, or list of values
count
The number of items to sample

Optional inputs

withReplacement
Whether to sample with replacement, where items can appear multiple times in the sample. Defaults to false.
updateContinuously
If True the output will change on every doc edit. Otherwise, the number will only be generated once. Defaults to True.

Output

Outputs a random sample of count items from list. By default, samples without replacement and regenerates on every edit.

ReverseList(list)

Copy link

Reverse the values in a list

List(1, 5, 3, 7, 2).ReverseList()
[2, 7, 3, 5, 1]

Inputs

list
A table, column, or list of values

Output

Returns list reversed.

Sequence(start, end, by)

Copy link

Returns a list of numbers between the provided from and to parameters

Sequence(1, 10)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Sequence(0, 50, 10)
[0, 10, 20, 30, 40, 50]

Required inputs

start
The number to start from
end
The number to end at

Optional inputs

by
The increment or step between numbers in the sequence. Defaults to 1 or -1 depending on start and end

Output

Outputs a list of numbers from start to end. Step size is controlled via the by input.

Unique(value)

Copy link

Deduplicate values

List("Dog", "Dog", "Cat", "Mouse").Unique()
[Dog, Cat, Mouse]
List(1, 2, 3).Unique()
[1, 2, 3]

Inputs

value...
A value to deduplicate

Output

Outputs a list of unique value(s). Deduplicates against each item in a value if it is a list.

Logical

And(value)

Copy link

Returns true if all the items are true, otherwise false

And(Today() > Date(2015, 4, 23), Bugs.Count() < 5)
true
And(True(), True())
true
And(True(), False())
false

Inputs

value...
A value to check

Output

Outputs True if all value(s) are true. Otherwise returns False.

False()

Copy link

Outputs false

False()
false

Output

Outputs False.

If(condition, ifTrue, ifFalse)

Copy link

Get a value conditionally (single condition)

If(Today() > Date(2015, 4, 23), "Hello world", "Not true")
Hello world
If(Today() < Date(2015, 4, 23), "Hello world", "Not true")
Not true

Inputs

condition
An expression that outputs true or false
ifTrue
A value to output if condition is true
ifFalse
A value to output if condition is false

Output

Outputs ifTrue if the condition is true. Otherwise outputs ifFalse.

IfBlank(value, ifBlank)

Copy link

Get a value with fallback if blank

IfBlank("Hello world", "Alternate text")
Hello world
IfBlank("", "Alternate text")
Alternate text

Inputs

value
The value to return if not blank
ifBlank
The value outputted if valueis blank

Output

Outputs ifBlank if value is blank. Otherwise outputs value.

Not(value)

Copy link

Negate a true or false value

True().Not()
false
Not(False())
true

Inputs

value
A value to negate

Output

Outputs True if valueis false and False if value is true.

Or(value)

Copy link

Check if any input is true

Or(Today() > Date(2015, 4, 23), Bugs.Count() < 5)
true
Or(True(), False())
true
Or(False(), False())
false

Inputs

value...
A value to check

Output

Outputs True if any value is true. Otherwise outputs False.

Switch(expression, value, result, arg)

Copy link

Get a value conditionally. Handles multiple conditions

Switch(Year(Today()), 2024, "The past", 2025, "The now", 2026, "The future")
The now
Switch("In progress", "Done", 10, "Open", 1, 5)
5

Inputs

expression
A value or expression to check
value
Check if this matches expression
result
If value matches expression output this value
arg...
Any number of value and result pairs followed by an optional default value

Output

Outputs the first result where value matches expression. Outputs an optional final value if no value matches.

SwitchIf(condition, ifTrue, arg)

Copy link

Get a value conditionally. Handles multiple conditions with a fallback

SwitchIf(Today() > Date(2100, 1, 20), "Hello future!", Year(Today()) >= 2000, "Hello present!", "Hello past!")
Hello present!

Inputs

condition
A formula that ouputs true or false
ifTrue
A value to output if condition is true
arg...
Any number of condition and ifTrue pairs followed by an optional default value

Output

Outputs the first ifTrue value where condition is true. Outputs the an optional final value if no condition is true.

True()

Copy link

Outputs true

True()
true

Output

Outputs true.

Math

AbsoluteValue(number)

Copy link

Get the absolute value of a number

AbsoluteValue(-14)
14
AbsoluteValue(123)
123

Inputs

number
A number

Output

Outputs number without the sign, so negative numbers become positive in the output.

Average(value)

Copy link

Averages a list of numbers ignoring any blank values

Planets.[Number of moons].Average()
25.875
Average(1, 3, 5, 7)
4

Inputs

value...
A numeric value or list of numeric values

Output

Outputs the average value. Blank values are ignored. All items in value are averaged if value is a list.

BinomialCoefficient(n, k)

Copy link

Calculates the Binomial Coefficient

BinomialCoefficient(6, 2)
15

Inputs

n
The number of possibilities to choose from. Any non-negative integer
k
The number of items to choose. Any non-negative integer less than or equal to n

Output

Outputs the number of ways to choose k items out of n possibilities. In math, the symbols nCk and (n k) can denote a bionmial coefficient, and are sometimes read as "n choose k".

Ceiling(value, factor)

Copy link

Rounds a number up to the nearest multiple

Ceiling(3.14, 0.1)
3.2
Ceiling(7, 3)
9

Required inputs

value
A number to round up

Optional inputs

factor
A number multiple that value should round up to. Defaults to 1

Output

Outputs value rounded up to the nearest multiple of factor.

Even(value)

Copy link

Rounds a number up to the nearest even number

Even(3)
4
Even(2.33)
4

Inputs

value
A number to round

Output

Outputs value rounded up to the nearest even number.

Exponent(value)

Copy link

Returns Euler's number e (~2.718) raised to a power

Exponent(2)
7.389056099

Inputs

value
A number

Output

Outputs Euler's number for value e (~2.718) raised to a power.

Factorial(value)

Copy link

Calculates the product of an integer and all the integers below it

Factorial(4)
24

Inputs

value
An integer number

Output

Outputs the product of an integer value and all the integers below it. If the number if a decimal will only use the initial integer. Note: Inputs greater than 19 may cause precision errors.

Floor(value, factor)

Copy link

Rounds a number down to the nearest multiple

Floor(3.14, 0.1)
3.1
Floor(7, 3)
6

Required inputs

value
A number to round down

Optional inputs

factor
A number multiple that value should round up to. Defaults to 1

Output

Outputs value rounded down to the nearest multiple of factor.

IsEven(value)

Copy link

Checks if a value is even

IsEven(17)
false
IsEven(6)
true

Inputs

value
A value to check

Output

Outputs True if value is even. Otherwise returns False.

IsOdd(value)

Copy link

Checks if a value is odd

IsOdd(17)
true
IsOdd(6)
false

Inputs

value
A value to check

Output

Outputs True if value is odd. Otherwise returns False.

Ln(number)

Copy link

Get the natural logarithm of a number. (Base e)

Ln(100)
4.605170186

Inputs

number
A number

Output

Outputs the logarithm of number, base e (Euler's number).

Log(number, base)

Copy link

Get the logarithm of a number for a given base

Log(128, 2)
7

Inputs

number
A number
base
Logarithm base to use

Output

Outputs the logarithm of number to base.

Log10(number)

Copy link

Get the logarithm of a number (base 10)

Log10(100)
2

Inputs

number
A number

Output

Get the logarithm of number (base 10).

Max(value)

Copy link

Get the maximum number or date/time

Max(1, 3, 5, 7, 11)
11

Inputs

value...
A numeric value or list of numeric values

Output

Outputs the maximum value. Blank values are ignored. Checks all items in value if value is a list. Use MaxBy instead to get the maximum value by a specific criteria.

Median(value)

Copy link

Get the median number or date/time

Median(1, 3, 5, 7, 11)
5

Inputs

value...
A numeric value or list of numeric values

Output

Outputs the median value. Blank values are ignored. Checks all items in value if value is a list.

Min(value)

Copy link

Gets the minimum number or date/time

Min(1, 3, 5, 7, 11)
1

Inputs

value...
A numeric value or list of numeric values

Output

Outputs the minimum value. Blank values are ignored. Checks all items in value if value is a list. Use MinBy instead to get the minimum value by a specific criteria.

Mode(value)

Copy link

Get the most common value

Mode(1, 3, 3, 3, 5, 7)
3

Inputs

value...
A value or list of values

Output

Outputs the mode (most frequently occurring) value. Blank values are ignored. Checks all items in value if value is a list.

Odd(value)

Copy link

Rounds a number up to the nearest odd number

Odd(2)
3
Odd(1.23)
3

Inputs

value
A number to round

Output

Outputs value rounded up to the nearest odd number.

Percentile(dataset, percentile)

Copy link

Get the value at a given percentile of a dataset

Percentile(List(10, 22, 7, 2, 5), 0.5)
7
Percentile(List(4, 2, 10, 6, 8, 12), 0.1)
3

Inputs

dataset
A list of numbers
percentile
The percentile from dataset to return

Output

Outputs the interpolated value at the given percentile within dataset.

PercentileRank(dataset, value)

Copy link

Get percentile rank of a value in a dataset

PercentileRank(List(10, 22, 7, 2, 5), 7)
0.5
PercentileRank(List(4, 2, 10, 6, 8, 12), 12)
1

Inputs

dataset
A list of numbers
value
The value to find within dataset

Output

Outputs the percentile rank of value within dataset.

The mathematical π (pi) constant

Pi()
3.141592654

Output

Outputs the mathematical π (pi) constant.

Power(number, exponent)

Copy link

Calculates a number raised to a power

Power(2, 3)
8
Power(10, 2)
100

Inputs

number
A number to be raised to a power
exponent
The power to raise number by

Output

Outputs number raised to exponent.

Product(value)

Copy link

Multiplies numbers together

Product(3, 5, 2)
30

Inputs

value...
A number of list of numbers to multiply

Output

Outputs the mathematical product of all values. Blank values are ignored. Multiplies all items in value if value is a list.

Quotient(dividend, divisor)

Copy link

Divide one number by another

Quotient(10, 5)
2

Inputs

dividend
A number to divide
divisor
A number to divide dividend by

Output

Outputs dividend divided by divisor.

Random(updateContinuously)

Copy link

Generate a random number

Random()
0.423029953691942

Optional inputs

updateContinuously
If True the output will change on every doc edit. Otherwise, the number will only be generated once. Defaults to True.

Output

Outputs a random number between 0 and 1 (including 0, excluding 1). Regenerates on every edit by default.

RandomInteger(low, high, updateContinuously)

Copy link

Generate a random number between two values

RandomInteger(1,10)
7

Required inputs

low
The smallest number that can be generated
high
The largest number that can be generated

Optional inputs

updateContinuously
If True the output will change on every doc edit. Otherwise, the number will only be generated once. Defaults to True.

Output

Outputs a random number between low and high.

Rank(value, dataset, ascending)

Copy link

Returns the ordered position of a value in a list

Rank(12, List(10, 15, 12, 3, 5, 1))
2

Required inputs

value
The value to rank
dataset
The list of numbers to sort and then search

Optional inputs

ascending
If true dataset will be sorted in ascending order, else descending. Defaults to false.

Output

Outputs the position of a value within dataset when sorted.

Remainder(dividend, divisor)

Copy link

Gets the remainder from dividing two numbers

Remainder(7, 3)
1
Remainder(17, 5)
2

Inputs

dividend
A number of divide
divisor
A number to divide dividend by

Output

Outputs the remainder when dividend is divided by divisor.

Round(number, places)

Copy link

Round a number

Round(3.14159, 2)
3.14
Round(48.111, 0)
48

Required inputs

number
A number to round

Optional inputs

places
The number of decimal places to round to

Output

Outputs number rounded to the specific number of decimal places.

RoundDown(number, places)

Copy link

Round a number down

RoundDown(3.14159, 3)
3.141
RoundDown($48.999, 0)
$48.00

Required inputs

number
A number to round

Optional inputs

places
The number of decimal places to round to

Output

Outputs number rounded down to the specified number of decimal places.

RoundTo(value, factor)

Copy link

Rounds one number to the nearest integer multiple of another

RoundTo(22, 14)
28
RoundTo(8, 5)
10

Inputs

value
A number to round
factor
A numeric multiple that value should round to

Output

Outputs value rounded to the nearest multiple of factor. If no factor is specified rounds to the nearest integer.

RoundUp(number, places)

Copy link

Round a number up

RoundUp(3.14159, 2)
3.15
RoundUp($48.01, 0)
$49.00

Required inputs

number
A number to round

Optional inputs

places
The number of decimal places to round to

Output

Outputs number rounded up to the specified number of decimal places.

Sign(number)

Copy link

Get the sign of a number

Sign(13)
1
Sign(-4)
-1

Inputs

number
A number

Output

Outputs -1 if number is negative, 0 if number is zero, or 1 if number is positive.

SquareRoot(number)

Copy link

Calculates the square root of a number

SquareRoot(64)
8

Inputs

number
A number

Output

Outputs the square root of number.

StandardDeviation(value)

Copy link

Estimates the standard deviation of a population based on a sample of values

StandardDeviation(1, 3, 5, 7, 11)
3.847076812334269

Inputs

value...
A number or list of numbers

Output

Outputs the estimated standard deviation based on the sample in values. Blank values are ignored. All items in value are considered if value is a list.

StandardDeviationPopulation(value)

Copy link

Calculates the standard deviation based on an entire population

StandardDeviationPopulation(1, 3, 5, 7, 11)
3.4409301068170506

Inputs

value...
A number or list of numbers

Output

Outputs the standard deviation based on values that make up the entire population. Blank values are ignored. All items in value are considered if value is a list.

Sum(value)

Copy link

Adds numbers together

Sum(1, 2, 3, 4)
10

Inputs

value...
A number or list of numbers to sum

Output

Outputs the mathematical sum of all values. Blank values are ignored. Sum all items in value if value is a list.

SumProduct(list1, list2)

Copy link

Calculates the total from multiplying two lists

SumProduct(List(1, 2), List(3, 4))
11

Inputs

list1
A list of numbers
list2
An equally sized list of numbers

Output

Outputs the total sum of the products of list1 and list2. Each list must be of equal size.

Truncate(number, places)

Copy link

Truncates a number

Truncate(3.14159, 4)
3.1415

Required inputs

number
A number

Optional inputs

places
The number of decimal places to truncate at

Output

Outputs number truncated to places.

Misc

DocId(url)

Copy link

Gets the document ID from a Coda doc URL.

DocId("https://coda.io/d/My-Doc_dAbCdEfGhIj")
AbCdEfGhIj

Inputs

url
A Coda URL

Output

Outputs the document ID from the given url.

ObjectLink(object, displayText)

Copy link

Get the url for an object

thisDocument.ObjectLink()
https://coda.io/d/_d[your doc here]

Required inputs

object
A Coda object. This includes tables, views, rows, and docs.

Optional inputs

displayText
Display Text to give to the URL object.

Output

Outputs a URL for object.

PageName(object)

Copy link

Get the name of the page an object belongs to

thisTable.PageName()
[Current page name]

Inputs

object
A Coda object. This includes pages, tables, views, controls, and canvas formulas.

Output

Outputs the name of the page that object belongs to.

ParseCSV(csvString, delimiter)

Copy link

Converts a CSV to list

ParseCSV("Hello,World,!", ",")
["Hello", "World", "!"]
ParseCSV("I'm a TSV", Character(9))
["I'm", "a", "TSV"]

Required inputs

csvString
A delimited string value.

Optional inputs

delimiter
The delimiter to use. Defaults to ","

Output

Outputs a list of items by parsing a csvString delimited by a delimiter. The delimiter can be changed to work with other formats like TSV. You can also use our CSV importer for one-off imports.

SwapDocIdInUrl(url, docId)

Copy link

Updates a Coda doc URL to point to a new doc id.

SwapDocIdInUrl("https://coda.io/d/My-Doc_dABCDEFG", "1234567")
https://coda.io/d/My-Doc_d1234567

Inputs

url
A Coda URL
docId
The new document ID

Output

Outputs the updated URL.

Object

ParseJSON(jsonString, path)

Copy link

Parses a JSON string

ParseJSON('{"name": "Mike", "location": "New York"}', "$.name")
Mike

Required inputs

jsonString
A JSON string. For example: '{"name": "Bob", "age": 42}'

Optional inputs

path
A path within the JSON; for example, "$.pull_request.state".See https://goessner.net/articles/JsonPath/ for details.

Output

Outputs the value parsed from jsonString at path. If path is not specified, outputs the entire parsed value.

People

CreatedBy(object)

Copy link

Get the creator for a row or other object

thisRow.CreatedBy()
@John Doe

Inputs

object
A Coda object. This includes tables, views, columns, rows, and docs.

Output

Outputs the user who created object.

IsSignedIn()

Copy link

Checks if the current user is logged in

Output

Outputs True if the current user is logged in. Otherwise, outputs False.

ModifiedBy(object)

Copy link

Returns the user who modified the previous item

thisRow.ModifiedBy()
@John Doe

Inputs

object
A Coda object. This includes tables, views, columns, rows, and docs.

Output

Outputs the user who modified object most recently.

User()

Copy link

Get the current logged in user

User()
@John Doe

Output

Outputs the current user. Will be different for every user. Note: * User().email returns the current user emails * User().name returns the current users name *User().photo returns the current users photo *User().state returns the current users doc access (e.g. write access).

Relational

Let(value, name, expression)

Copy link

Names a value so you can refer to it inside an expression. Useful if you want to use a value multiple times (i.e., as a local variable) or give it a clearer name. If you have a nested formula with an inner and outer CurrentValue, you can give each of them distinct names

Let(Tasks.Count(), n, If(n > 0, n, "Done!"))
5
List(1, 2, 3, 4).Filter(CurrentValue.Let(n, n > 1 and n < 4))
[2, 3]

Inputs

value
The value you want to rename
name
A shorter name you can use to refer to value. Enter the name without quotes
expression
Any formula. Inside this formula, you can use name to reference value

Output

Outputs the result of expression.

RowId(row)

Copy link

A unique ID for a row

thisRow.RowId()
14

Inputs

row
A row in a table

Output

Outputs a unique ID for row.

WithName(value, name, expression)

Copy link

Names a value so you can refer to it inside an expression. Useful if you want to use a value multiple times (i.e., as a local variable) or give it a clearer name. If you have a nested formula with an inner and outer CurrentValue, you can give each of them distinct names

WithName(Tasks.Count(), n, If(n > 0, n, "Done!"))
5
List(1, 2, 3, 4).Filter(CurrentValue.WithName(n, n > 1 and n < 4))
[2, 3]

Inputs

value
The value you want to rename
name
A shorter name you can use to refer to value. Enter the name without quotes
expression
Any formula. Inside this formula, you can use name to reference value

Output

Outputs the result of expression.

RichText

BulletedList(value)

Copy link

Create a bulleted list of values

BulletedList("Dog", "Cat", "Mouse")
• Dog • Cat • Mouse

Inputs

value...
A value or list of values

Output

Outputs a bulleted list of given value(s).

IndentBy(text, levels)

Copy link

Change the relative indent of content

IndentBy("Foo", 1)
Foo

Inputs

text
A text value
levels
The number of levels to indent by. Can be positive or negative.

Output

Outputs text with indent adjusted by levels.

NumberedList(value)

Copy link

Create a numbered list of values

NumberedList("Dog", "Cat", "Mouse")
1. Dog 2. Cat 3. Mouse

Inputs

value...
A value or list of values

Output

Outputs a numbered list of given value(s).

Shape

ClipCircle(image)

Copy link

Crops an image into a circle

ClipCircle(Image("https://pbs.twimg.com/profile_images/671865418701606912/HECw8AzK.jpg"))

Inputs

image
An image to crop

Output

Outputs a cropped circular image.

Embed(url, width, height, force)

Copy link

Get an HTML embed for a URL

Embed("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
Embed("https://www.theverge.com/2017/10/19/16497444/coda-spreadsheet-krypton-shishir-mehrotra", 400, 500)

Required inputs

url
The URL or web address to display

Optional inputs

width
How wide to render the embed. Use 0 for default.
height
How tall to render the embed. Use 0 for default.
force
Load the URL directly in your browser using compatibility mode. Used for pages with sign ins.

Output

Outputs an HTML embed for url with the specified width and height.

Hyperlink(url, displayValue)

Copy link

Create a link

Hyperlink("www.google.com", "Google")
Google

Required inputs

url
The URL or web address to link to

Optional inputs

displayValue
The text to show

Output

Outputs a link that shows the given displayValue and navigates to url.

HyperlinkCard(url)

Copy link

Creates rich url card

HyperlinkCard("cnn.com")

Inputs

url
The URL or web address to display

Output

Outputs a card for the given url.

Image(url, width, height, name, style, outline)

Copy link

Gets an image for a URL

Image("https://pbs.twimg.com/profile_images/671865418701606912/HECw8AzK.jpg")

Required inputs

url
The URL of an image. Includes GIF, PNG, and JPG

Optional inputs

width
How wide to render the image. Use 0 for default.
height
How tall to render the image. Use 0 for default.
name
Alternative text of the image
style
One of auto or circle
outline
Whether or not to render outline around image. Defaults to true.

Output

Outputs an image for url with the specified width, height, name, style, and outline.

Rectangle(width, height, color, name)

Copy link

Generates a rectangle

Rectangle(200, 20, "#007AF5")

Required inputs

width
How wide to render the rectangle.

Optional inputs

height
How tall to render the rectangle. Use 0 for default.
color
Color as RGB hex #RRGGBB (black if omitted)
name
Alternative text of the image

Output

Outputs a rectangle with specified width, height, color, and name.

Spatial

Distance(location1, location2, unit)

Copy link

Returns the distance (in kilometers) between two locations (lat/long) on earth using the Haversine formula

Distance(Location(33.9206418,-118.3303341), Location(37.4274787, -122.1719077))
521.8529425485297

Required inputs

location1
Coordinates of lat and long. Use Location()
location2
Coordinates of lat and long. Use Location()

Optional inputs

unit
"M"iles, "N"autical miles or "K"ilometers. Defaults to "K"ilometers if not specified

Output

Outputs the distance in specified unit between location1 and location2 using the Haversine formula.

Location(latitude, longitude, altitude, heading, speed, accuracy, altitudeAccuracy)

Copy link

Get location for the provided lat-long

Location(33.9206418,-118.3303341)
[33.9206418,-118.3303341, , ]

Required inputs

latitude
Position in decimal degrees
longitude
Position in decimal degrees

Optional inputs

altitude
Altitude relative to sea level
heading
Direction of travel in degrees
speed
Meters per second
accuracy
accuracy of latitude and longitude in meters
altitudeAccuracy
accuracy of altitude in meters

Output

Outputs a single location object using latitude and longitude. Can also optionally include altitude, heading, speed, accuracy, and altitudeAccuracy. Useful with Distance().

String

Character(charNumber)

Copy link

Create a unicode character (symbol)

Concatenate(Character(191), "Que Pasa?")
¿Que pasa?
Concatenate(Character(34), "Keep me in quotes", Char(34))
"Keep me in quotes"

Inputs

charNumber
A number that matches a unicode value

Output

Outputs a single unicode character matching the charNumber given. https://en.wikipedia.org/wiki/List_of_Unicode_characters.

Concatenate(text)

Copy link

Combine multiple text values

Concatenate("Notes for", Today())
Notes for 3/8/2017

Inputs

text...
Any text value. Includes text, numbers, and dates

Output

Outputs the combined text of all text values as a single text value.

ContainsText(text, searchText, ignoreCase, ignoreAccents, ignorePunctuation)

Copy link

Check if one text contains another.

ContainsText("a needle in the haystack", "needle")
true
ContainsText("Trippers and askers surround me", "trip")
false
ContainsText("But they are not the Me myself", "me", true)
true
ContainsText("crème fraîche", "creme", false, true)
true

Required inputs

text
The text value to search in.
searchText
A text value to search for.

Optional inputs

ignoreCase
Whether to ignore case when searching. Defaults to false.
ignoreAccents
Whether to ignore diacritics (accents, umlauts, cedillas, etc.) when checking. Defaults to false.
ignorePunctuation
Whether to ignore punctuation when (quotes, commas, periods, etc.) when searching. Defaults to false.

Output

Outputs True if text contains searchText.

DecodeFromBase64(base64Text)

Copy link

Decodes base64 encoded text

DecodeFromBase64("VGhlIHF1aWNrIC8gQnJvd24gZm94Pw")
The quick / Brown fox?

Inputs

base64Text
The base64 encoded text

Output

Outputs base64Text as a string.

EncodeAsBase64(text)

Copy link

Encodes text as base64

EncodeAsBase64("The quick / Brown fox?")
VGhlIHF1aWNrIC8gQnJvd24gZm94Pw==

Inputs

text
The text to base64 encode

Output

Outputs text base64 encoded.

EncodeForUrl(text)

Copy link

Encodes text use in a URL

EncodeForUrl("The quick / Brown fox?")
The%20quick%20%2F%20Brown%20fox%3F

Inputs

text
The text to encode

Output

Outputs text formatted so it can be used in the query string of a URL.

EndsWith(text, suffix, ignoreCase, ignoreAccents)

Copy link

Check if text ends with a suffix

EndsWith("Hello world", "Find me")
false
EndsWith("Hello world", "world")
true
EndsWith("Hello World", "world", true)
true
EndsWith("Hej världen", "varlden", false, true)
true

Required inputs

text
The text to check
suffix
The ending sub-text to check for

Optional inputs

ignoreCase
Whether to ignore case when checking. Defaults to false.
ignoreAccents
Whether to ignore diacritics (accents, umlauts, cedillas, etc.) when checking. Defaults to false.

Output

Outputs True if text ends with suffix. Otherwise outputs False.

Format(template, text)

Copy link

Substitute values into a text template

Format("This is my {1} and it is {2}", "doc", "great")
This is my doc and it is great
Format("{1:0000}-{2:00}-{3:00}", Today().Year(), Today().Month(), Today().Day())
2018-06-05

Inputs

template
A text value. To substitute a value, use {X} or {X:Y}. X is the nth argument after the format string. The Y part is optional. It determines how to pad the string if the value is not as long as Y.
text...
The text to insert at {X}. The first will insert at {1}, the second at {2} and so on

Output

Outputs text with all {X} values in template replaced with the matching text.

Join(delimiter, text)

Copy link

Combine multiple text values with a delimiter

Join("-", "This", "is", "Awesome")
This-is-Awesome

Inputs

delimiter
A text value to use as a delimiter
text...
Text or list of text values

Output

Outputs text combining all text(s) with delimiter in-between every item.

Left(text, numberOfCharacters)

Copy link

Extract starting characters from text

Left("Hello world", 3)
Hel

Inputs

text
The text to extract a prefix from
numberOfCharacters
The number of characters to output

Output

Outputs the starting numberOfCharacters from text.

LeftPad(text, targetLength, padString)

Copy link

Pad text from the left

LeftPad("10", 3)
10
LeftPad("99", 5, "0")
00099
LeftPad("foo", 1)
foo

Required inputs

text
The value to pad the start of
targetLength
The length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string will be returned as is.

Optional inputs

padString
The text to pad text with. Defaults to " " (space)

Output

Outputs text padded with padString at the start so that the resulting text has the given targetLength.

Length(text)

Copy link

Returns length of the given text

Length("Hello world")
11

Inputs

text
A text value

Output

Outputs the number of characters in text.

LineBreak(softLineBreak)

Copy link

Returns a line break

Concatenate("First", LineBreak(), "Second")
First Second

Optional inputs

softLineBreak
Whether to create a soft line break without additional spacing. Defaults to false.

Output

Outputs a line break.

Lower(text)

Copy link

Convert text to lower case

Lower("Hello WORLD")
hello world

Inputs

text
A text value

Output

Outputs text with all characters made lower case.

Middle(text, start, numberOfCharacters)

Copy link

Extract characters from the middle of text

Middle("Hello world", 3, 5)
llo w

Inputs

text
A text value
start
The character position to start from. Starts at 1
numberOfCharacters
The number of characters to extract

Output

Outputs numberOfCharacters from text starting at position.

RegexExtract(text, regularExpression, regexFlags)

Copy link

Return the parts of text that match a regular expression

Required inputs

text
A text value
regularExpression
A Javascript regular expression. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Using_special_characters for documentation and test expressions at https://www.regextester.com

Optional inputs

regexFlags
Flags to use with regularExpression. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Advanced_searching_with_flags_2

Output

Outputs the portions of text that match regularExpression

RegexMatch(text, regularExpression)

Copy link

Check if text matches a regular expression

RegexMatch("Top Floor Pacific Heights Flat w/Parking (marina / cow hollow) $1200 1bd 800ft", "([$]\d+)")
true

Inputs

text
A text value
regularExpression
A Javascript regular expression. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Using_special_characters for documentation and test expressions at https://www.regextester.com

Output

Outputs True if text matches regularExpression.

RegexReplace(text, regularExpression, replacementText)

Copy link

Substitute regular expression matches

RegexReplace("Top Flat w/Parking (marina / cow hollow) $1200 1bd 800ft", "([$]\d+)", "$2000")
Top Flat w/Parking (marina / cow hollow) $2000 1bd 800ft

Inputs

text
A text value
regularExpression
A Javascript regular expression. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Using_special_characters for documentation and test expressions at https://www.regextester.com
replacementText
Text to substitute

Output

Outputs text with all regularExpression matches replaced with replacementText.

Repeat(text, repetitions)

Copy link

Repeats text multiple times

Repeat("ha", 4)
hahahaha

Inputs

text
The text to repeat
repetitions
How many times to repeat text

Output

Outputs text based on repeating text by the number of repetitions specified.

Replace(text, start, numberOfCharacters, replacementText)

Copy link

Replace a range within text

Replace("Spreadsheets", 1, 6, "Bed")
Bedsheets

Inputs

text
A text value
start
The character position to start from. Starts at 1
numberOfCharacters
The number of characters to remove
replacementText
Text to substitute

Output

Outputs text with numberOfCharacters removed starting at and replaced with replacementText.

Right(text, numberOfCharacters)

Copy link

Extract ending characters from text

Right("Hello world", 3)
rld

Inputs

text
The text to extract a suffix from
numberOfCharacters
The number of characters to output

Output

Outputs ending characters of text.

RightPad(text, targetLength, padText)

Copy link

Pad text from the right

RightPad("10", 3)
10
RightPad("99", 5, "0")
99000
RightPad("foo", 1)
foo

Required inputs

text
The value to pad the start of
targetLength
The length of the resulting text once text has been padded. If the value is lower than the current text's length, then text will be returned as is.

Optional inputs

padText
The string to pad text with. Defaults to " " (space)

Output

Outputs text padded with padText at the end so that the resulting text has the given targetLength.

Split(text, delimiter)

Copy link

Split text on a delimiter

Split("I-need-these-apart-3/10/2017", "-")
[I, need, these, apart, 3/10/2017]

Inputs

text
A text value to split up
delimiter
The character to split on. Use LineBreak() to split each line

Output

Outputs a list generated from splitting text by the delimiter character.

StartsWith(text, prefix, ignoreCase, ignoreAccents)

Copy link

Check if text starts with specified characters

StartsWith("Hello world", "Find me")
false
StartsWith("Hello world", "Hello")
true
StartsWith("Hello world", "hello", true)
true
StartsWith("Hej världen", "Hej var", false, true)
true

Required inputs

text
The text to check.
prefix
The prefix to check for.

Optional inputs

ignoreCase
Whether to ignore case when checking. Defaults to false.
ignoreAccents
Whether to ignore diacritics (accents, umlauts, cedillas, etc.) when checking. Defaults to false.

Output

Outputs True if text starts with prefix. Otherwise outputs False.

Substitute(text, searchFor, replacementText)

Copy link

Replace the first matching substring in some text

Substitute("Hello world", "Hello", "Good morning")
Good morning world
Substitute("ho ho ho", "ho", "yo")
yo ho ho

Inputs

text
A text value
searchFor
The text value to search for
replacementText
Text to substitute

Output

Outputs text with the first searchFor match replaced with replacementText.

SubstituteAll(text, searchFor, replacementText)

Copy link

Replace all matching substrings in some text

SubstituteAll("The Cat in the Hat", "at", "orn")
The Corn in the Horn

Inputs

text
A text value
searchFor
The text value to search for
replacementText
Text to substitute

Output

Outputs text with all searchFor matches replaced with replacementText.

ToByteSize(byteCount, base)

Copy link

Pretty-print a byte count (KB, MB, GB, etc.)

ToByteSize(265318)
265.32 kB
ToByteSize(265318, 2)
259.1 KB

Required inputs

byteCount
A number of bytes

Optional inputs

base
conversion base, 2 or 10 (default)

Output

Outputs a text rendering of byteCount (KB, MB, GB, etc.).

ToHexadecimal(decimalNumber, targetLength)

Copy link

Convert a number to a hexadecimal string

ToHexadecimal(10)
A
ToHexadecimal(10, 4)
000A

Required inputs

decimalNumber
A decimal number

Optional inputs

targetLength
The target length

Output

Outputs a text of decimalNumber converted to hexadecimal. Left-pads result with 0's to satisfy targetLength if specified.

Trim(text)

Copy link

Trim starting and ending spaces from text

Trim(" loooking good! ")
looking good!
Trim("Stay positive ")
Stay positive

Inputs

text
A text value

Output

Outputs text with all of the leading and trailing spaces removed.

Upper(text)

Copy link

Convert text to upper case

Upper("hello")
HELLO

Inputs

text
A text value

Output

Outputs text with all characters made upper case.

Actions

Activate(object)

Copy link

Places the cursor on the given object

Activate(Tasks.first())
An action which when triggered will bring up the row input form for the specified row.

Inputs

object
A Coda object. This includes table, views, columns, rows, and docs

Output

Outputs an action which (when run) will place the cursor on object.

AddOrModifyRows(table, expression, column, columnValue)

Copy link

Modify matching rows or add one if none match

AddOrModifyRows(Tasks, Status = "Open", Description, "Send out metrics")
An action which when triggered will add a row to Tasks table and set the Description column to "Send out metrics" if there are no rows that have status set to "Open". If it finds matching rows, will update the Description in all rows to "Send out metrics".

Inputs

table
The table to modify
expression
Filter to rows you want to modify
column...
The column to populate
columnValue...
The value to set in column

Output

Outputs an action which (when run) will modify all rows in table matching expression with specified columnValue(s). If no rows match, will add a new row.

AddRow(table, column, columnValue)

Copy link

Add a row to the table

AddRow(Tasks, Description, "Send out metrics")
An action which when triggered will add a row to Tasks table and set the Description column to "Send out metrics".

Inputs

table
The table to modify
column...
The column to populate
columnValue...
The value to set in column

Output

Outputs an action which (when run) will add a new row to table and update the specified column(s) with columnValue(s).

CopyDoc(title, url, folder)

Copy link

Copy a document to your document list

CopyDoc()
An action which when triggered will copy this document.
CopyDoc('newTitle')
An action which when triggered will copy this document, and rename it 'newTitle'.
CopyDoc('newTitle', 'https://coda.io/d/My-Doc_dQw4t2TMcVQ/')
An action which when triggered will copy the document at the url, and rename it 'newTitle'.
CopyDoc('newTitle', 'https://coda.io/d/My-Doc_dQw4t2TMcVQ/', 'fl-123345')
An action which when triggered will copy the document at the url, and rename it 'newTitle', and pre-select the folder to copy to.
CopyDoc('newTitle', 'https://coda.io/d/My-Doc_dQw4t2TMcVQ/', 'https://coda.io/folders/fl-123345')
An action which when triggered will copy the document at the url, and rename it 'newTitle', and pre-select the folder to copy to.
CopyDoc('newTitle', 'fl-123345')
An action which when triggered will copy this document, and rename it 'newTitle', and pre-select the folder to copy to.'
CopyDoc('newTitle', 'https://coda.io/folders/fl-123345')
An action which when triggered will copy this document, and rename it 'newTitle', and pre-select the folder to copy to.

Optional inputs

title
The title of the new doc (optional).
url
The url of the doc to copy (optional)
folder
The id or url of the folder to copy the doc to (optional)

Output

Outputs an action which (when run) will copy this or another document.

CopyPageToDoc(page)

Copy link

Copies the current page to a new doc or to another doc

CopyPageToDoc()
Copies the current page to a new doc or to another doc

Optional inputs

page
The page that will be copied

Output

An action which when triggered will copy the current page.

CopyToClipboard(content)

Copy link

Copy content to your clipboard

CopyToClipboard("https://google.com")
An action which when triggered will copy "https://google.com" to the user's clipboard.

Inputs

content
The content to copy to the clipboard

Output

Outputs an action which (when run) will copy content to your clipboard. Rich text formatting will not be preserved.

DeleteRows(rows)

Copy link

Deletes specified rows

DeleteRows(Tasks.filter(Status != "Done"))
An action which when triggered will delete all rows returned by the filter.

Inputs

rows
A list of rows to delete

Output

Outputs an action which (when run) will delete each row in rows.

DuplicatePage(page, name, parentPage, copySubpages, duplicateOptions, rowOptions)

Copy link

Duplicates a page

DuplicatePage([Topic template], 'Launch discussions', [Parent page], true, 'CreateViews')
An action which when triggered will create a new page named "Launch discussions" by duplicating the page named "Topic template". The new page will be created under the "Parent page", have its subpages copied, and have views created for existing tables.

Required inputs

page
The page that will be duplicated.

Optional inputs

name
Name for the new page.
parentPage
The page to create the new page under. Defaults to the parent of page .
copySubpages
Whether to copy all subpages of page. Defaults to false.
duplicateOptions
Behavior when the page has tables and views. If set to "CreateViews", edits to data in the new page will show up in the original tables too. If set to "DuplicateData", edits to data in the new page won't affect the rest of your doc. If set to "DuplicateTables", edits to views in the new page will show up in the original table, and other edits won't affect the rest of your doc. Defaults to "CreateViews".
rowOptions
This parameter is used to specify which rows should be included. It should be one of - All, Visible, None. If set to `All`, all rows including those hidden by a view will be included. If set to `Visible`, only visible rows will be included. If set to `None`, none of the rows will be included. This option is only used if duplicateOptions is not "CreateViews".

Output

Outputs an action (when run) which will create a duplicate page of page with the given name.

DuplicateRows(rows, column, columnValue)

Copy link

Duplicates one or more rows

DuplicateRows(thisRow, Status, "Done")
An action which, when triggered, will duplicate thisRow and update the Status column to "Done."

Inputs

rows
The rows in a table to duplicate
column...
The column to modify
columnValue...
The value to set in column

Output

Outputs an action value which (when run) will duplicate the target rows and modify the specified column(s) with columnValue.

ModifyRows(rows, column, columnValue)

Copy link

Modify values in one or more rows

ModifyRows(Tasks.filter(Status != "Done"), Status, "Done")
An action which when triggered will update the Status column in all rows returned by the filter to Done.

Inputs

rows
The rows in a table to modify
column...
The column to modify
columnValue...
The value to set in column

Output

Outputs an action value which (when run) will modify the specified column(s) with columnValue(s) for each row in rows.

NoAction()

Copy link

Does nothing.

If(HasCheckedAgreement, CopyDoc(), NoAction())
If HasCheckedAgreement is true, the doc will be copied. Otherwise no action will be taken.

Output

Outputs an action which (when run) does nothing.

Notify(people, message)

Copy link

Notify doc users

Notify([Owner], "Hey [Owner], can you update your status?"
A notification will be created against the person(s) within [Owner] stating the text

Inputs

people
The person or list of people to notify
message
The message to send

Output

Outputs an action which (when run) will send message to people via an email and in-app notification.

OpenRow(row, viewOrLayout, viewMode)

Copy link

Opens the row

OpenRow(Tasks.first(), View, "Fullscreen")
An action which when triggered will bring up the row from the view specified.

Required inputs

row
The row to open

Optional inputs

viewOrLayout
The view to use to open the row
viewMode
The view mode to use for the opened row (modal, fullscreen, center, or right)

Output

Outputs an action which (when run) will open the row.

OpenWindow(url)

Copy link

Open a link in a new tab

OpenWindow("https://www.google.com")
An action which when triggered will open a new window with the specified input.

Inputs

url
The web address to open

Output

Outputs an action which (when run) will open url in a new browser tab.

RefreshAssistant(references)

Copy link

Refresh assistant related things

RefreshAssistant(AiBlock)
The AiBlock will be refreshed.

Inputs

references...
The column or block to refresh

Output

Outputs an action which (when run) refreshes assistant data in references(s).

RefreshColumn(column)

Copy link

Refresh Pack columns

Refresh(PR)
The PR column will be refreshed.

Inputs

column...
The column to refresh

Output

Outputs an action which (when run) refreshes Pack data in column(s).

RefreshTable(tableRef)

Copy link

Refreshes the given Pack table. This is not supported in automations.

RefreshTable(Events)
The Events table will be refreshed.

Inputs

tableRef
Pack table

Output

Outputs an action which (when run) queues up a sync of the given table. Subsequent actions may complete before the sync starts, but syncs in the queue are processed sequentially.

ResetControlValue(control)

Copy link

Resets the value of a control

ResetControlValue(PersonalTextbox)
An action which when triggered will reset the PersonalTextbox control value to the default value.
ResetControlValue(CollaborativeTextbox)
An action which when triggered will clear the CollaborativeTextbox control value.
ResetControlValue(CollaborativeCheckbox)
An action which when triggered will set the CollaborativeCheckbox control value to false.

Inputs

control
The control to reset

Output

Outputs an action value which (when run) will reset the value of control.

RunActions(action)

Copy link

Run one or more actions

RunActions(Tasks.CloseBugs)
An action which when triggered will click all buttons in the CloseBugs column.

Inputs

action...
The action to run

Output

Outputs an action which (when run) will run all provided action(s).

SetControlValue(control, value)

Copy link

Set the value of a control

SetControlValue(StatusTextbox, "Done")
An action which when triggered will set the StatusTextbox to Done.

Inputs

control
The control to set
value
The value to set for the control

Output

Outputs an action value which (when run) will set the specified control with value.

SetPackSyncTableConfigValue(targetUrl, settingName, settingValue)

Copy link

Set the sync field setting for a sync table.

Inputs

targetUrl
The url to the sync table to update
settingName
The sync field setting to modify
settingValue
The value to set in settingName

SignUpForCoda()

Copy link

Open a dialog that prompts the user to sign up for Coda

SignUpForCoda()
An action which will either have a snackbar pop up saying the user is already signed in or open a modal to allow the user to sign in

Output

An action which when triggered will allow the user to sign up/sign in to Coda if they are not already signed in.