# Formulas

## Arrays

### All(list, expression)

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)

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)

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)

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)

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.

### Duplicates(value)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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.

## Collections

### Count(list)

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)

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)

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)

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)

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)

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)

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
Property of object or column of table to sort on
sortByCount
True to order elements by count or False to order elements by value. Defaults to True.

#### Output

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

### Splice(value, start, deleteCount, insertValue)

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)

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()

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)

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.

### DateTimeTruncate(dateTime, unit)

Round a date/time

`Time(1, 30, 45).DateTimeTruncate("minute")`
1:30 AM
`Time(1, 30, 45).DateTimeTruncate("hour")`
1:00 AM

#### Inputs

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

#### Output

Outputs dateTime rounded to the nearest unit.

### DateToEpoch(date)

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)

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

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

dateTime
A date/time

#### Output

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

### DocumentTimezone()

Get the document's timezone

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

#### Output

Outputs the document's timezone.

### EndOfMonth(dateTime, monthOffset)

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)

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(dateTime)

Get the hour from a date/time

`Hour(Time(1, 30, 45))`
1

dateTime
A date/time

#### Output

Outputs the hour of the given dateTime as a number.

### IsoWeekNumber(dateTime)

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

dateTime
A date/time

#### Output

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

### IsoWeekday(dateTime)

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

dateTime
A date/time

#### Output

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

### Minute(dateTime)

Get the minute from a date/time

`Minute(Time(1, 30, 45))`
30

dateTime
A date/time

#### Output

Outputs the minute of the given dateTime as a number.

### Modified(object)

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)

Get the month from a date

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

dateTime
A date/time

#### Output

Outputs the month of the given dateTime as a number.

### MonthName(dateTime, format)

Get the month name for a date

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

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)

Count working days between dates

`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.

### Now(precision)

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".

#### Output

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

### RelativeDate(dateTime, months)

`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(dateTime)

Get the "second" from a date/time

`Second(Time(1, 30, 45))`
45

dateTime
A date/time

#### Output

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

### Time(hour, minute, second)

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)

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)

Convert text into a date value

`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)

Converts text into a date/time

`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)

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()

Get today's date

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

#### Output

Outputs the current date. Updates daily.

### WeekNumber(dateTime, returnType)

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

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)

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

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)

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

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

dateTime
A date/time

#### Output

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

### Workday(startDate, numWorkingDays, holidays)

Adds working days to a date

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

#### Required Inputs

startDate
The date to count from
numWorkingDays
Number of work days (Mon-Fri) to move the date forward

#### 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)

Get the year of a date

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

dateTime
A date/time

#### Output

Outputs the year of the given dateTime as a number.

## Duration

### Days(days)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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

### IsBlank(value)

Check if a value is blank

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

value
A value to check

#### Output

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

### IsDate(value)

Checks if a value is a date

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

value
A value to check

#### Output

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

### IsLogical(value)

Checks if a value is true or false

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

value
A value to check

#### Output

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

### IsNotBlank(value)

Checks if a value is not blank

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

value
A value to check

#### Output

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

### IsNotText(value)

Checks if a value is not text

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

value
A value to check

#### Output

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

### IsNumber(value)

Checks if a value is a number

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

value
A value to check

#### Output

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

### IsText(value)

Checks if a value is text

`IsText("Hello world")`
true
`IsText(14)`
false

value
A value to check

#### Output

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

### ToNumber(value, base)

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)

Convert a value to text

`ToText(11431)`
"11431"

#### Inputs

value
A value to convert

#### Output

Outputs value as text.

## Logical

### And(value)

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

value...
A value to check

#### Output

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

### False()

Outputs false

`False()`
false

Outputs False.

### If(condition, ifTrue, ifFalse)

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)

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)

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)

Check if any input is true

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

value...
A value to check

#### Output

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

### Switch(expression, value, result, arg)

Get a value conditionally. Handles multiple conditions

`Switch(Year(Today()), 2021, "The past", 2022, "The now", 2023, "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)

Get a value conditionally. Handles multiple conditions with a fallback

`SwitchIf(Today() > Date(2024, 01, 20), "Hello future!", Year(Today()) = 2022, "Hello present!", Today() < Date(2017, 03, 04), "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.

Outputs true

`True()`
true

Outputs true.

## Math

### AbsoluteValue(number)

Get the absolute value of a number

`AbsoluteValue(-14)`
14
`AbsoluteValue(123)`
123

number
A number

#### Output

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

### Average(value)

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)

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)

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)

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)

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

`Exponent(2)`
7.389056099

value
A number

#### Output

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

### Factorial(value)

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)

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)

Checks if a value is even

`IsEven(17)`
false
`IsEven(6)`
true

value
A value to check

#### Output

Outputs True if value is even. Otherwise returns False.

### IsOdd(value)

Checks if a value is odd

`IsOdd(17)`
true
`IsOdd(6)`
false

value
A value to check

#### Output

Outputs True if value is odd. Otherwise returns False.

### Ln(number)

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

`Ln(100)`
4.605170186

number
A number

#### Output

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

### Log(number, base)

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)

Get the logarithm of a number (base 10)

`Log10(100)`
2

number
A number

#### Output

Get the logarithm of number (base 10).

### Max(value)

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)

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)

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)

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)

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)

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)

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.

### Pi()

The mathematical π (pi) constant

`Pi()`
3.141592654

#### Output

Outputs the mathematical π (pi) constant.

### Power(number, exponent)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

Get the sign of a number

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

number
A number

#### Output

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

### SquareRoot(number)

Calculates the square root of a number

`SquareRoot(64)`
8

number
A number

#### Output

Outputs the square root of number.

### StandardDeviation(value)

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)

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)

`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)

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)

Truncates a number

`Truncate(3.14159, 4)`
3.1415

number
A number

#### Optional Inputs

places
The number of decimal places to truncate at

#### Output

Outputs number truncated to places.

## Misc

Get the url for an object

`ExampleTable.ObjectLink()`

#### Required Inputs

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

#### Optional Inputs

displayText
Display Text to give to the URL object.

#### Output

Outputs a URL for object.

### ParseCSV(csvString, delimiter)

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.

## Object

### ParseJSON(jsonString, path)

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)

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()

Checks if the current user is logged in

#### Output

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

### ModifiedBy(object)

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()

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

### RowId(row)

A unique ID for a row

`thisRow.RowId()`
14

row
A row in a table

#### Output

Outputs a unique ID for row.

### WithName(value, name, expression)

Names a value so you can refer to it inside an expression. Useful if you want to use a value multiple times 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)

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)

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)

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)

Crops an image into a circle

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

image
An image to crop

#### Output

Outputs a cropped circular image.

### Embed(url, width, height, force)

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

#### Output

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

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

url

displayValue
The text to show

#### Output

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

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)

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)

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
Text to appear when hovering over the rectangle

#### Output

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

## Spatial

### Distance(location1, location2, unit)

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)

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
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)

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)

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)

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.

#### Output

Outputs True if text contains searchText.

### DecodeFromBase64(base64Text)

Decodes base64 encoded text

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

#### Inputs

base64Text
The base64 encoded text

#### Output

Outputs base64Text as a string.

### EncodeAsBase64(text)

Encodes text as base64

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

#### Inputs

text
The text to base64 encode

#### Output

Outputs text base64 encoded.

### EncodeForUrl(text)

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)

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)

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)

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)

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("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

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)

Returns length of the given text

`Length("Hello world")`
11

text
A text value

#### Output

Outputs the number of characters in text.

### LineBreak(softLineBreak)

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)

Convert text to lower case

`Lower("Hello WORLD")`
hello world

text
A text value

#### Output

Outputs text with all characters made lower case.

### Middle(text, start, numberOfCharacters)

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.

### RegexMatch(text, regularExpression)

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)

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)

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)

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)

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("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

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)

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)

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)

Replace a matching substring in some text

`Substitute("Hello world", "Hello", "Good morning")`
Good morning world

#### Inputs

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

#### Output

Outputs text with the first searchFor match replaced with replacementText.

### ToByteSize(byteCount, base)

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.).

Convert a number to a hexadecimal string

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

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)

Trim starting and ending spaces from text

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

text
A text value

#### Output

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

### Upper(text)

Convert text to upper case

`Upper("hello")`
HELLO

text
A text value

#### Output

Outputs text with all characters made upper case.

## Actions

### Activate(object)

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.

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.

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)

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'

#### Optional Inputs

title
The title of the new doc (optional).

#### Output

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

### CopyPageToDoc(page)

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)

`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)

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)

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.

### ModifyRows(rows, column, columnValue)

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.

### Notify(people, message)

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)

Opens the row

`OpenRow(Tasks.first(), SimpleLayout, "Fullscreen")`
An action which when triggered will bring up the row using the layout specified.

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" or "Fullscreen"

#### Output

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

### OpenWindow(url)

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.

url

#### Output

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

### RefreshColumn(column)

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)

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

`RefreshTable(Events)`
The Events table will be refreshed.

tableRef
Pack table

#### Output

Outputs an action which (when run) triggers sync on the given table

### ResetControlValue(control)

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)

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)

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.

### SignUpForCoda()

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