Summer Functions

Date

Function Signature Description
DATE DATE(year, month, day)date Build a date from year, month, and day
DATEADD DATEADD(date, days)date Add N days to a date
DATEDIFF DATEDIFF(date1, date2)decimal Number of days between two dates
DATEFORMAT DATEFORMAT(date, format)string Format a date as a text string
DAY DAY(date)integer Extract the day of month from a date
DAYS DAYS(end_date, start_date)decimal Days from start_date to end_date (end − start)
DAYS360 DAYS360(start_date, end_date)integer Days between dates using 30-day months (360-day year)
DAYS_AGO DAYS_AGO(date)decimal Number of days since a date
EDATE EDATE(date, months)date Add N calendar months to a date
EOMONTH EOMONTH(date, months)date Last day of the month N months from a date
HOUR HOUR(datetime)integer Extract the hour (0–23) from a datetime
ISOWEEK ISOWEEK(date)integer ISO week number from a date
MINUTE MINUTE(datetime)integer Extract the minute (0–59) from a datetime
MONTH MONTH(date)integer Extract the month number (1–12) from a date
NOW NOW()datetime Return the current date and time
QUARTER QUARTER(date)integer Extract the quarter number (1–4) from a date
STARTOFMONTH STARTOFMONTH(date)date First day of the month for a date
STARTOFWEEK STARTOFWEEK(date)date First day (Monday) of the week for a date
STARTOFYEAR STARTOFYEAR(date)date First day of the year for a date
TODAY TODAY()date Return today's date
WEEKDAY WEEKDAY(date)integer Day of week number (1=Mon) from a date
WORKDAY WORKDAY(date, days)date Add N business days to a date
WORKDAYS WORKDAYS(date1, date2)integer Number of weekdays between two dates
YEAR YEAR(date)integer Extract the year from a date
YEARFRAC YEARFRAC(start_date, end_date)decimal Fractional years between two dates (actual/365.25)

Logic

Function Signature Description
AND AND(bool, …)boolean True if all arguments are true
COALESCE COALESCE(value, …)string Return the first non-blank value from a list
FIRST FIRST(type, value, …)string Return the first matching value of a given type from a list
IF IF(condition, then, else_)string Return one value if a condition is true, another if false
ISBLANK ISBLANK(value)boolean True if a value is blank or empty
ISEQUAL ISEQUAL(value, …)boolean True if all values are equal (strings trimmed before comparison)
ISERROR ISERROR(value)boolean True if a value is an error
NOT NOT(bool)boolean Negate a boolean value
OR OR(bool, …)boolean True if any argument is true
VALID VALID(value)string Return the value if valid, blank otherwise

Numeric

Function Signature Description
ABS ABS(number)decimal Absolute value of a number
AVG AVG(number, …)decimal Average of a list of numbers
CEIL CEIL(number)integer Round up to the nearest integer
CLAMP CLAMP(number, min, max)decimal Constrain a value to a min/max range
COL COL(index)string Value of the column at the given 1-based source-file index for the current row
COUNT COUNT(value, …)integer Count the number of non-blank values
CUMSUM CUMSUM({col})decimal Running sum of a column from the first sorted row through the current row
CUMSUM_GROUP CUMSUM_GROUP({col})decimal Running sum of a column within the current group, resetting at each new group
EXP EXP(number)decimal e raised to a power
FIRSTROW FIRSTROW({col})string Value of a column on the first row in sort order
FLOOR FLOOR(number)integer Round down to the nearest integer
GROUP_TOTAL GROUP_TOTAL({col})decimal Sum of the column's values within the current group (falls back to dataset total when not grouped)
ISEVEN ISEVEN(number)boolean True if number is even
ISODD ISODD(number)boolean True if number is odd
LASTROW LASTROW({col})string Value of a column on the last row in sort order
LN LN(number)decimal Natural logarithm (base e)
LOG LOG(number, base)decimal Logarithm with arbitrary base
MARGIN MARGIN(revenue, cost)percentage Gross margin: (revenue − cost) / revenue
MARKUP MARKUP(revenue, cost)percentage Markup over cost: (revenue − cost) / cost
MAX MAX(number, …)decimal Return the maximum value
MEDIAN MEDIAN(number, …)decimal Middle value of a set of numbers
MIN MIN(number, …)decimal Return the minimum value
MOD MOD(number, divisor)decimal Remainder after dividing number by divisor
MROUND MROUND(number, multiple)decimal Round to nearest multiple
PERCENTOF PERCENTOF(part, total)decimal Percentage of part relative to total (0–100)
PERCENT_GROUP PERCENT_GROUP({col})percentage Row value as a percentage of the group total (falls back to dataset total when not grouped)
PERCENT_TOTAL PERCENT_TOTAL({col})percentage Row value as a percentage of the column total across the full dataset
PERCHANGE PERCHANGE(value1, value2)percentage Percent change from value1 to value2: (value2 − value1) / value1
POW POW(base, exp)decimal Raise a base to an exponent
PREV PREV({col}, default)string Value from the previous row in sort order. PREV() = self; PREV(col) = other column; optional second arg sets the first-row default (0 if omitted)
PRODUCT PRODUCT(number, …)decimal Multiply a list of numbers
PROFIT PROFIT(revenue, cost)decimal Gross profit: revenue − cost
PRORATA PRORATA({col}, value)decimal Allocates value proportionally: value × (col / TOTAL(col))
PRORATA_GROUP PRORATA_GROUP({col}, value)decimal Allocates value proportionally within the current group: value × (col / GROUP_TOTAL(col))
ROLLUP ROLLUP({col}, which)decimal Pre-computed aggregate for a column: total/sum, avg/mean, min, max, count, median, distinct, rows, empty, error
which: avg | count | distinct | empty | error | max | median | min | rows | sum | total
ROUND ROUND(number, digits)decimal Round a number to N decimal digits
ROUNDDOWN ROUNDDOWN(number, digits)decimal Round toward zero to N decimal places
ROUNDUP ROUNDUP(number, digits)decimal Round away from zero to N decimal places
ROW ROW()integer 1-based position of the current row in sort order
SIGN SIGN(number)integer Return 1, 0, or -1 based on the sign of a number
SQRT SQRT(number)decimal Square root of a number
SUM SUM(number, …)decimal Sum a list of numbers
TOTAL TOTAL({col})decimal Sum of all values in the column across the full dataset
TRUNC TRUNC(number, digits)decimal Truncate a number to N decimal digits

String

Function Signature Description
ALPHA ALPHA(text)string Extract the first contiguous run of letter characters from text
CHAR CHAR(code)string Character from a Unicode code point
CLEAN CLEAN(text)string Remove non-printable characters from text
CODE CODE(text)integer Unicode code point of the first character
CONCAT CONCAT(text, …)string Join two or more text values
CONTAINS CONTAINS(text, search)boolean True if text contains the search string
CURRENCY CURRENCY(value)string Return the ISO 4217 currency code for a money column or country code
DATEPARSE DATEPARSE(text, format)date Parse a text string into a date using a format pattern
DESLUGIFY DESLUGIFY(text)string Convert a slug (hyphens/underscores) into title-case words
ENDSWITH ENDSWITH(text, suffix)boolean True if text ends with the given suffix
FIND FIND(text, search)integer Position of search string within text (0 if not found)
GET GET(source, part)string Extract a named component from a typed value (country, currency, state, email, url, or name)
part: code | code2 | code3 | complete_name | currency | domain | family | first | first_last | full_domain | given | last | last_first | middle | name | nickname | path | phonetic | prefix | proto | querystring | suffix | surname | tld | username
JOIN JOIN(sep, text, …)string Join text values with a separator
LEFT LEFT(text, n)string First N characters of text
LEN LEN(text)integer Number of characters in text
LOWER LOWER(text)string Convert text to lowercase
NAME NAME(source, part)string Extract a component from a person's name (given, family, middle, prefix, suffix, nickname, first_last, last_first, complete_name, phonetic)
part: complete_name | family | first | first_last | given | last | last_first | middle | nickname | phonetic | prefix | suffix | surname
NUMBERVALUE NUMBERVALUE(text)decimal Parse a text string as a number
NUMERIC NUMERIC(text)decimal Extract the longest numeric value (ignoring commas) from text
PADLEFT PADLEFT(text, width, char)string Left-pad text to a fixed width
PADRIGHT PADRIGHT(text, width, char)string Right-pad text to a fixed width
PROPER PROPER(text)string Capitalize the first letter of each word
RAW RAW({col})string Original source string for the column exactly as loaded from file
REGEXEXTRACT REGEXEXTRACT(text, pattern)string Extract the first regex match (or capture group) from text
REGEXMATCH REGEXMATCH(text, pattern)boolean True if text matches a regular expression
REGEXREPLACE REGEXREPLACE(text, pattern, replacement)string Replace regex matches in text with a replacement string
REGION REGION(postal_code, country)string State/province code from a postal code (USA or CAN)
REJOIN REJOIN(sep, string, part, …)string Split string on sep, extract the numbered parts (1-based), and rejoin them with sep
REPEAT REPEAT(text, count)string Repeat text N times
REPLACE REPLACE(text, search, replacement)string Replace occurrences of search text with replacement
REVERSE REVERSE(text)string Reverse the characters in a text string
REVERSE_JOIN REVERSE_JOIN(sep, string)string Split string on sep, reverse the parts, and rejoin with sep
RIGHT RIGHT(text, n)string Last N characters of text
SLICE SLICE(text, start, end)string Substring from start to end position
SLUGIFY SLUGIFY(text)string Convert text to a slug (lowercase, underscores, ASCII)
SLUGIFY_SEP SLUGIFY_SEP(text, sep)string Convert text to a slug using a custom separator character
SPLIT SPLIT(text, delim, n)string Nth token from splitting text by a delimiter
STARTSWITH STARTSWITH(text, prefix)boolean True if text starts with the given prefix
TEXT TEXT(number, format)string Format a number as text using a format string
TRIM TRIM(text)string Remove leading and trailing whitespace
UPPER UPPER(text)string Convert text to uppercase