Klipfolio Klips offers a variety of Excel-like functions to perform calculations and manipulate data.
This article includes:
- List of all functions
- About the formula bar
- Tip - Removing column headers from raw data
- The Function Reference Guide
List of all functions
The following table includes a categorized list of all functions with links to information for each one.
About the formula bar
Functions are used in the formula bar when working with data sources in the modeller and when editing and building Klips in the Klip Editor.
In the formula bar, you can type in formulas or select from a list of functions. When you start typing a function name, a list of functions filtered by the letter you entered is displayed. Function Help with examples and parameters automatically displays for each function in a pop-up window. Learn more about using the formula bar.
There are some differences between writing formulas in the modeller and writing formulas in the Klip Editor:
-
In the modeller:
- Calculations are performed to prepare and organize data and make it easier to use when building custom Klips.
- Formulas reference tabular data by their sheet and column name, for example,
@A:Aor@Sheet 1, A:A.
-
In the Klip Editor:
- Formulas in the Klip Editor reference data by their column name, for example,
@Productor@Shipment location. If a raw data source (one that's not modelled) is used in the Klip Editor, the syntax of the column reference is@A:A.
- Formulas in the Klip Editor reference data by their column name, for example,
Tip - Removing column headers from raw data
The column header is typically a textual title that gives each column of data a name. Since calculations and data detections are performed on entire columns, the column header can cause issues when it is in a different format than the rest of the column. For example, a column of data may be considered as text if it has a textual title even when it contains numeric data. For these reasons, it’s important to remove column headers from your data. You can remove column headers in the following ways:
-
Recommended options:
- Create a modelled data source from your raw data source and use the Exclude Rows property. Learn more about setting properties for a modelled data source.
- In the Klip Editor, use the Filter action to Exclude the column header from your data. Learn more about the Filter action.
-
Alternative option:
- In the formula bar, wrap the SLICE function around a column of data to remove the first row.
The Function Reference Guide
Klipfolio functions are separated into these categories: Data manipulation, logic, math, text, date/time, statistics, and Klipfolio functions for JSON data. The following tables are organized by category and include the purpose of each function along with information and tips/examples on using them in Klips.
Data manipulation functions
| Function | Description |
|---|---|
| ARRAY |
Use ARRAY to join together single values and return them as a single list of data in the order provided. Syntax and Parameters:
When to use this function: To combine data from multiple sources, such as data sources and results references. Example: Append column B to column A. A:A contains [A, B, C, D] B:B contains [E, F, G] Formula:
Results: A, B, C, D, E, F, G |
| BLANK |
Use BLANK to return one blank value or a specified number of blank values. Syntax and Parameters:
When to use this function: To replace a non-blank cell with a blank cell. Example: Return a list of 5 blank items. Formula:
Results: 5 blank items |
| COUNTDISTINCT |
Use COUNTDISTINCT to count the number of unique items in each group. The results are returned in alphabetical order and (optionally) aligned with the results of the GROUP function. Syntax and Parameters:
Related functions: When to use this function: To aggregate data according to specified groups. Example: Count the number of times each State appears in the data. A:A contains [California, Texas, California, California, New York, New York] A:A contains [California, Texas, California, California, New York, New York] Formula:
Results: 3,2,1 Note: You can also use the Group and Aggregate actions to return results similar to COUNTDISTINCT. Actions are available in the Klip Editor. Learn more about the actions menu. Learn more: |
| DATASOURCE |
Use the DATASOURCE function to indirectly refer to a data source field, by specifying the datasource ID (a unique 32-digit hexadecimal identifier) and a pointer to the field in the datasource. Syntax and Parameters:
When to use this function: To access a specific sheet name in an Excel/Google workbook where the sheet name is indicated by a variable or to access a specific XPath in a JSON/XML datasource that is inaccessible by XPath manipulation. Example: Return the values in column A using DATASOURCE. A:A in datasource ID 0123456789abcdef0123456789abcdef contains [California, Texas, California, California, New York, New York] Formula:
Results: California, Texas, California, California, New York, New York Note: The DATASOURCE function is used with raw data sources, not modelled data sources. Contact Support if you need help with this advanced function. Learn more: |
| FIRST |
Use FIRST to return the first values in a list of data where the number of values is specified by the count parameter. Syntax and Parameters:
Example: A:A contains [California, Texas, California, California, New York, New York] Formula:
Results: California Note: If the value of the count parameter is greater than the number of items in the column, all items will be returned. If the data is grouped and there are fewer unique values than the value of the count parameter, only the number of unique values will be returned. |
| GROUP |
Use GROUP to group data into unique instances and hide duplicate values. The results are returned in alphabetical order. Syntax and Parameters:
Related functions: Example: Get the list of states from column A. A:A contains [California, Texas, California, California, New York, New York] Formula:
Results: California, New York, Texas Note: You can also use the Group action to return the same results as GROUP. Actions are available in the Klip Editor. Learn more about the actions menu. Learn more: |
| GROUPBY |
Use GROUPBY to return values based on a specified aggregation method so that the unique values align with a parallel column. Syntax and Parameters:
Related functions: Example: Sum the data in column B by state. A:A contains [California, Texas, California, California, New York, New York] B:B contains [3, 7, 20, 10, 5, 11] Formula:
Results: 33, 16, 7 Example: Average the data in column B by state. A:A contains [California, Texas, California, California, New York, New York] B:B contains [3, 7, 20, 10, 5, 11] Formula:
Results: 11, 8, 7 Note: You can also use the Group action to return results similar to GROUP and GROUPBY. Actions are available in the Klip Editor. Learn more about the actions menu. Learn more: |
| LAST |
Use LAST to return the last values in a list of data where the number of values is specified by the count parameter. Syntax and Parameters:
Example: A:A contains [California, Texas, California, California, New York, New York] Formula:
Results: New York Note: If the value of the count parameter is greater than the number of items in the column, all items will be returned. If the data is grouped and there are fewer unique values than the value of the count parameter, only the number of unique values will be returned. |
| LOOKUP |
Use LOOKUP to correlate data between two data sources. For each input item, search for the first match in keys and return the value at the corresponding position in results. If there is no match, a blank is returned. Syntax and Parameters:
When to use this function: To correlate data between data sources and to align data across sub-components (for example, in a Bar/Line chart to align a series with the X-axis). Example: Get the countries from data source 2 for the cities listed in data source 1. Use the city name in each data source to lookup the data. Data Source 1 A:A contains [Vancouver, Ottawa, London, Washington, New York, Montreal], Data Source 2 A:A contains [New York, Washington, Montreal, Ottawa, Vancouver], Data Source 2 B:B contains [US, US, CAN, CAN, CAN] Formula:
Results: CAN, CAN, BLANK(), US, US, CAN Learn more: |
| MAPFLAT/MAP |
Use MAPFLAT/MAP to assign each item in values, one at a time to a variable, and then execute the formula using the variable name. Returns all the items that the formula returns. Syntax and Parameters:
When to use this function: To aggregate data over a set of account IDs by repeating a reference to a dynamic data source where the account ID is passed in as a variable. Example (MAPFLAT): A:A contains temperatures [2, 4, 6, 1] B:B contains cities [Ottawa, Toronto, Vancouver, Winnipeg] Formula:
Results: [Winnipeg, Ottawa, Winnipeg, Ottawa, Toronto, Winnipeg] Note: We recommend using MAPFLAT rather than MAP because MAPFLAT supports returning multiple items per first parameter while MAP returns only 1 item (if the formula returns 1 item, only the first item is returned). Contact Support if you need help with this advanced function. Learn more: |
| PADVALUES |
Use PADVALUES to return selected values with padding or additional values at the end of the data. Syntax and Parameters:
When to use this function: To make two lists of data the same size and to ensure data alignment. Example: Pad column A with 5 zeros. A:A contains [3, 5, 20] Formula:
Results: 3, 5, 20, 0, 0, 0, 0, 0 Example: In this example the difference between the number of values in column B and column C is used as the amount of values to pad column C with. Formula:
|
| REPEAT |
Use REPEAT to replicate one or more values and return a list containing the number of copies specified. Syntax and Parameters:
Example:
The result of this formula is Canada, Canada, Canada |
| REPLACE |
Use REPLACE to replace items that match a specified value with another value. Syntax and Parameters:
Example: Change CA to California. A:A contains [CA, New York, CA, CA, Texas] Formula:
Results: California, New York, California, California, Texas |
| REVERSE |
Use REVERSE to reverse the order of a list of values. Syntax and Parameters:
Example: A:A contains [1, 2, 3, 4, 5] Formula:
Results: 5, 4, 3, 2, 1 |
| SELECT |
Use SELECT to select values from a list according to specified criteria. Syntax and Parameters:
Example: Return the cities in California. A:A contains [California, New York, California, California, Texas] B:B contains [Los Angeles, New York, San Francisco, Palo Alto, Houston] Formula:
Results: Los Angeles, San Francisco, Palo Alto Note: When working with data in the Klip Editor, we recommend using the filter feature instead of using SELECT. Learn more about filtering. Learn more: |
| SET |
Use SET to assign the values listed in the second parameter to the variables listed in the first parameter. Syntax and Parameters:
When to use this function: assign values for dynamic data sources that have multiple variables. Contact Support if you need help with this advanced function. Example: Given a dynamic Google Analytics data source query which includes the A:A contains [ga:country,Canada] B:B contains [ga:sessions,15638] Formula:
Results: 15638 Learn more: |
| SLICE |
Use the SLICE function to return the subset of values between the start and end positions. If start and end parameters are not specified the first row is removed. Syntax and Parameters:
When to use this function: Often used to remove row headers from data. Example: Remove the header cell from a column. A:A contains [A, B, C, D, E] Formula:
Results: B, C, D, E Note: If start and end parameters contain negative values, values are returned from the end of the list. |
| SORT |
Use the SORT function to sort values according to the specified order. Syntax and Parameters:
Example: Sort column A in descending order. A:A contains [Ontario, Alberta, Quebec] Formula:
Results: Quebec, Ontario, Alberta Note: You can also use the Sort action to return results similar to SORT. Actions are available in the Klip Editor. Learn more about the actions menu. |
| SPLICE |
Use the SPLICE function to return the values in the values parameter but delete the number of values specified in the count parameter from the position specified in the index parameter. Optionally inserts the value in the insert parameter at index. Syntax and Parameters:
Example: Splice the value "x" into column A. A:A contains [a, b, c, d, e] Formula:
Results: a, b, x, e |
| TRIM |
Use the TRIM function to remove the values specified in the pattern parameter or to remove all blank values if no pattern is provided. Syntax and Parameters:
Note: The pattern parameter is case sensitive. Example: Remove blanks from the data. A:A contains [ABC, BLANK(), FGH] Formula:
Results: ABC, FGH |
Logic functions
Math functions
Text functions
| Function | Description |
|---|---|
| CAPITALIZE |
Use CAPITALIZE to change the first letter in each word to uppercase. Syntax and Parameters:
Example: Capitalize "the 5th dimension". Formula:
Results: The 5th Dimension |
| CONCAT |
Use the CONCAT function to join two or more values into one text string. Syntax and Parameters:
Example: Create a sentence template using data from columns A, B and C. A:A contains [added, updated], B:B contains [May 22, 2025, Oct 2, 2025], C:C contains [2:20pm, 8:12am] Formula:
Results: The data source was added May 22, 2025 at 2:20pm The data source was updated Oct 22, 2025 at 8:12am |
| CONTAINS |
Use the CONTAINS function to test each value in the haystack parameter to see if it contains the value in the needle parameter. Syntax and Parameters:
Example: Return true for all values that have the letter "a" in them. A:A contains [Apple, Banana, Orange, Plum] Formula:
Results: false, true, true, false |
| COUNTRY_CLEAN |
Use the COUNTRY_CLEAN function to avoid multiple variations of a country’s name and return all the country names in the same form, either as full names or as ISO 3166 standardized names. If a value cannot be identified as a country, INVALID COUNTRY will display. Syntax and Parameters:
Examples:
The result is country names display in their full form, for example, Canada, Mexico, Canada, Canada, Canada, United States, United States, United States.
The result is country names display using the 2-character ISO code, for example, CA, MX, CA, CA, CA, US, US, US.
The result is country names display using the 3-character ISO code, for example, CAN, MEX, CAN, CAN, CAN, USA, USA, USA. |
| INDEXOF |
Use INDEXOF to search the values in the text parameter for the specified occurrence of the search text (case sensitive) parameter and return the position of where it is found. If search text is not found at the specified occurrence, null is returned. Syntax and Parameters:
Example: Return the position of the second occurrence of "at" in column A. A:A contains [abc, The Cat in the Hat] Formula:
Results: null, 16 Note: INDEXOF is typically used with SUBSTRING to determine where to begin or end the substring. |
| JOIN |
The JOIN function takes a set of values, joins these values with the glue parameter (a comma is used if glue is not specified), and returns them as a single value. Syntax and Parameters:
Example: A:A contains [January, February, March, April, May, June] Formula:
Results: January,February,March,April,May,June |
| LASTINDEXOF |
Use LASTINDEXOF to search the values in the text parameter for the last occurrence of the search text (case sensitive) parameter and return the position of where it is found. If search text is not found at the specified occurrence, null is returned. Syntax and Parameters:
Example: Return the position of the last occurrence of "at" in column A. A:A contains [abc, The Cat in the Hat] Formula:
Results: null, 16 Note: LASTINDEXOF is typically used with SUBSTRING to determine where to begin or end the substring. |
| LEFT |
Use the LEFT function to return the first character or a specified number of characters starting from the first value on the left. Syntax and Parameters:
Example: A:A contains [Bat Cat, The Cat in the Hat] Formula:
Results: B T Example: A:A contains [Bat Cat, The Cat in the Hat] Formula:
Results: Bat Cat The Cat |
| LENGTH |
Use the LENGTH function to count the number of characters in a text string. Syntax and Parameters:
Example: Count the number of characters in "Hello" and "Hello World". Formula:
Results: 5, 11 |
| LOWER |
Use the LOWER function to change all characters in the values parameter to lowercase. Syntax and Parameters:
Example: A:A contains [Bat Cat, The Cat in the Hat] Formula:
Results: bat cat the cat in the hat |
| NUMBERFORMAT |
Use the NUMBERFORMAT function to take a set of values, treat them as numbers, and return them as text with as many digits of decimal places as specified by the precision parameter. Syntax and Parameters:
Example: A:A contains [123.456, 1245687, January] Formula:
Results: 123, 1245687, 0 Note: If the data parameter is defined with text values or a blank, the results will be returned as a 0. |
| REMOVE_EMOJI |
Emojis are pictographs most often seen in social media data sources, such as Facebook posts. They may also appear in other data source types. As new emojis are developed, new encoding is used and sometimes this encoding cannot be processed by Klipfolio. The REMOVE_EMOJI function is used to strip emojis from data so the remaining data can be processed. Syntax and Parameters:
Example: Where message and name point to the /data/message and /data/from/name fields in a Facebook data source.
Note: If the selected data does not contain emojis, the REMOVE_EMOJI function returns the selected data as is. |
| RIGHT |
Use the RIGHT function to return the first character or a specified number of characters starting from the right of the first value. Syntax and Parameters:
Example: A:A contains [Bat Cat, The Cat in the Hat] Formula:
Results: Bat Cat, the Hat |
| SUBSTITUTE |
The SUBSTITUTE function replaces a set of characters with another set of characters in a text string. If the occurrence parameter is specified, that occurrence is substituted, otherwise, all occurrences are substituted. Syntax and Parameters:
Example: Substitute the 3rd occurrence of the letter a in each word in the data. A:A contains [Ottawa, banana] Formula:
Results: Ottawa, banan@ Note: While the SUBSTITUTE function is similar to the REPLACE function, the SUBSTITUTE function is used to replace part of a value. |
| SUBSTITUTE_REGEX |
Use SUBSTITUTE_REGEX to substitute text based on a specific pattern, such as location in text. REGEX (REGular EXPression) is a standard for describing patterns in text. There are several online resources, such as regexr.com., that describe how to define REGEX expressions. Syntax and Parameters:
Example: The regex anchor, ^, is used to match only when 'a' is the first character in a text string.
The result of this formula is xpple, bread, eggs. The regex anchor, $, matches the last character in a text string and the pipe (|) indicates 'or'.
The result of this formula is xpple, bananx, orange. Example: Substitute all characters until the last dash. A:A contains [Albany-Orlando-Ottawa] Formula:
Results: @Ottawa |
| SUBSTRING |
Use the SUBSTRING function to return a sub-string of text from a string of text. Syntax and Parameters:
Example: Return data after position 11 in each string. A:A contains [2025-10-11T1:12:00, 0123456789abcdef] Formula:
Results: 1:12:00, bcdef |
| TEXT_REVERSE |
Use the TEXT_REVERSE function to reverse the order of characters or numbers in the data. Syntax and Parameters:
Example: A:A contains [Canada, United States, Mexico] Formula:
Results: adanaC, setatS detinU, ocixeM |
| TRIM_WHITESPACE |
Use the TRIM_WHITESPACE function to return the text without leading and trailing spaces. Syntax and Parameters:
Example:
The result of this formula returns: Reseller, Distributor, Customer without the leading or trailing spaces. Example: Remove leading and trailing spaces around the word " Hello World ". Formula:
Results: Hello World |
| TRUNCATE |
Truncates text to the specified number of characters, starting from the position parameter and optionally inserting a style character. Syntax and Parameters:
Example: This example cuts off the text string after 5 characters and adds an ellipsis to the end of the value. Formula:
Results: abcde… |
| UPPER |
Use the UPPER function to change all characters in the values parameter to uppercase. Syntax and Parameters:
Example: A:A [Bat Cat, The Cat in the Hat] Formula:
Results: BAT CAT, THE CAT IN THE HAT |
| URLDECODE |
Use the URLDECODE function to decode data that is encoded for use in a URL using URLENCODE, UTF-8, to plain text. Syntax and Parameters:
Example: A:A contains Formula:
Results: www.myCompany.com/business users, www.klipfolio.com/klip-gallery Note: All dates in a Klip need to be in a common format to be useful. |
| URLENCODE |
Use the URLENCODE function to encode data to be safely used in URLs. Syntax and Parameters:
Example: A:A contains Formula:
Results: www.myCompany.com%2Fbusiness+users www.klipfolio.com%2Fklip-gallery |
Date/Time functions
When using Date/Time functions in Klipfolio Klips, it’s important to remember that formulas process the dates in Unix time format. This means that human readable date formats have to be converted before they can be used in formulas. When converting dates, the format of the date (that you want to convert) must be specified and must be entered as a string surrounded by quotes in the formula. Learn more about Date/Time formats.
Note: You can use an external Unix time converter to find the Unix time format of readable dates.
Time zones are an optional parameter available for specification in Date/Time functions. However, time zones can also be set at your account level and do not typically need to be set individually for every formula. Setting time zones in Klipfolio Klips.
Statistics functions
Klipfolio Functions for JSON data
Klipfolio functions for JSON data are the perfect choice for situations where more complex XPath manipulation is required to access and align JSON data. Learn more about JSON and XML data sources here.
| Function | Description |
|---|---|
| kf:element_at |
Syntax: Select an element at the position specified by index. This function is used when a field name is unnamed and is instead referenced by number (position). For example, using the following data source:
Example 1:
Returns:
Example 2:
Returns:
|
| kf:fill_elements |
Syntax: Note: You can enter the formula manually or generate it automatically by choosing the Selection Option Select all <field_name> elements in all <parent> elements, adding blanks for missing <field_name> elements. This function is used to “fill in” blanks for an element that is not included in every record. This is useful for data alignment. For example, using the following data source:
Example 1:
As is, the data incorrectly aligns Anders with the nickname, Rocket, and Maurice with the nickname, The Great One. Use
Returns: <blank>, Rocket, The Great One Example 2:
Returns: 1974-1978, <blank>, 1978-1979 Note: This function does not work for nested arrays. |
| kf:names |
Syntax: Note: You can enter the formula manually or generate it automatically by choosing the Selection Option Select all field names in <parent> element. The Example 1: For example, Facebook can return page fans data by gender and age. To create a list of these categories for a table column for a bar/line chart x-axis, use:
Which returns data shown in the following image:
Compare with More examples: The following show more examples using the data source featured in the previous function (
Note: Unnamed fields cannot be selected directly; see kf:element_at (described at the top of this table).
|


