Search the knowledge base, browse our resources, and visit our forum for more detailed information
Last updated: 25 Nov 2025
Functions are predefined operations used to perform calculations or manipulate data in XLSForm. They are essential for automating tasks and deriving key insights in your forms, allowing you to calculate project indicators, create scoring systems, and manage dates efficiently.
This article lists common functions used in XLSForm, including functions to manipulate numbers, strings, dates, and GPS points.
To learn more about form logic in XLSForm, see Introduction to form logic in XLSForm. To learn about functions specifically used in repeat groups, see Repeat groups in XLSForm.
The following functions are some of the most frequently used in XLSForm. They help control form behavior, manage responses, and perform basic calculations or logical operations across questions. These functions can be applied in calculations, constraints, relevance conditions, and other expressions throughout your form.
Function |
Description |
|---|---|
|
If the expression is TRUE, returns |
|
Used to determine if a specific choice was selected in a |
|
Returns a random number between 0.0 (inclusive) and 1.0 (exclusive). |
|
Returns the number of options selected in a |
|
Returns the first non-empty value of the two arguments. Returns an empty string if both are empty or non-existent. |
|
Returns the label value, in the active language, associated with the |
|
Returns a selected choice in a |
|
Evaluates an expression only once (e.g., to ensure a random number is only generated once, or to store the first value entered for a question even if the response is changed later). |
|
Retrieves a value from the choices sheet. Searches the choice list named |
The following functions are used to perform mathematical operations or transform numeric values in XLSForm. They can help you calculate, round, or convert numbers, as well as apply more advanced mathematical expressions when needed.
Function |
Description |
|---|---|
|
Transforms a decimal number into an integer without rounding. |
|
Rounds a decimal value to a predetermined number of decimal places. |
|
Calculates the power of a number. |
|
Converts x (a string or boolean expression) to a number value. |
|
Returns the natural log or base-10 log of a number. |
|
Returns the absolute value of a number. |
|
Returns the sine/arc sine, cosine/arc cosine, or tangent/arc tangent of a number. |
|
Returns the square root of a number. |
|
Returns e^x or 10^x. |
|
Returns an approximation of the mathematical constant π. |
Note: Inside these functions, either constants or question references can be included.
The following functions are used to create, modify, or analyze text strings in XLSForm. They are useful for combining text, checking for specific patterns or characters, and cleaning or formatting text inputs.
Function |
Description |
|---|---|
|
Concatenates one or more arguments (separated by commas) into a single string. |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns the substring of |
|
Returns the substring of |
|
Returns the substring of |
|
Returns a copy of string, where every occurrence of a character in |
|
Returns the number of characters in |
|
Returns a string in which any leading and trailing whitespaces in the string are removed, and sequences of whitespaces are replaced with a single space. |
The following functions are used to record, format, and calculate date and time values in XLSForm. They can help capture the current date or time, convert text into date format, or display dates and times in a specific format.
Function |
Description |
|---|---|
|
Returns the current date without a time component. |
|
Returns the current date and time in ISO 8601 format, including the timezone. |
|
Forces dates into the correct date format (especially for dates before 1970). |
|
Returns
|
|
Returns
|
The following functions are used to work with geographic data collected through GPS questions in XLSForm. They can calculate distances, perimeters, or areas based on geopoint, geotrace, or geoshape responses.
Function |
Description |
|---|---|
|
Returns the area, in square meters, of a |
|
Returns the distance, in meters, of either:
|
|
Returns |
Did you find what you were looking for? Was the information clear? Was anything missing?
Share your feedback to help us improve this article!
KoboToolbox is maintained by Kobo Inc.