We’re updating product names in our docs. Some references and links might be inaccurate today. Thanks for your patience.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Use functions in calculations

Learn about the inbuilt functions you can use when entering formulas in calculation columns.

Flex Modes is now Analytics in the new experience. Understand the changes

This page describes the inbuilt functions you can use when entering formulas in calculation columns in Analytics.

ABS

ABS(value)

Returns the absolute value of a number. Positive numbers and 0 remain unchanged. Negative numbers are returned as positive numbers.

Input

value: The number or column to evaluate.

Examples

  1. ABS(-2) returns 2.

  2. In the image below, the ABS calculation column uses ABS(Sep 2026, Value) to return the absolute value of each number in the Sep 2026 Value column.

    In rows 1 and 2, -647.95 and -6.06 become 647.95 and 6.06. Positive values, such as 14.97 in row 3, remain unchanged.

AND

AND(value1, value2)

Returns TRUE when all conditions are TRUE. If any condition is FALSE, it returns FALSE. Commonly used with the IF function.

Inputs

  • value1: The first condition to evaluate.

  • value2…: Optional additional conditions.

Each condition must return a value that AND can evaluate as TRUE or FALSE. AND treats 0 as FALSE and any nonzero value, including a negative value, as TRUE.

Examples

  1. AND(1, 1) returns 1 (TRUE) because both values are nonzero. AND(1, 0) returns 0 (FALSE) because one value is 0.

  2. In the image below, the AND calculation column uses AND(IF(W35 2026, Value > 0, 1, 0), IF(W36 2026, Value > 0, 1, 0)) to check whether the W35 2026 and W36 2026 values are both greater than 0. Each IF function returns 1 when its column's value is greater than 0 and 0 when it isn't. The AND function then evaluates these results.

    In rows 6 and 9, W36 2026 is empty, so its IF function returns 0. As a result, AND returns 0. In all other rows, both IF functions return 1, so AND returns 1.

ARRAY

ARRAY(value1, [value2…])

Groups one or more values into a single, ordered list. Commonly used as an input in other functions that require a series of values, such as FORECAST.LINEAR or PERCENTILE.

Inputs

  • value1: The first value or column within the list.

  • [value2…]: Optional additional values or columns to add to the list.

Examples

  1. ARRAY(1) returns an array containing one value: [1].

  2. ARRAY(1, 2, 3) returns an array containing three values: [1, 2, 3].

  3. See the FORECAST.LINEAR example for how to use ARRAY with quarterly columns to predict the next quarter's value.

  4. See the PERCENTILE example for how to use ARRAY to group column values into a series and calculate a percentile.

AVERAGE

AVERAGE(value1, [value2…])

Returns the average of a series of numbers.

Inputs

  • value1: The first value, column, or column range to include in the average.

  • [value2…]: Optional additional values, columns, or column ranges to include in the average.

Examples

  1. AVERAGE(1, 2, 3) returns 2.

  2. In the image below, the Average calculation uses AVERAGE(Aug 2026 Value, Sept 2026 Value, Oct 2026 Value) to calculate the average of the three monthly values in each row.

    In row 1, the values are 87,109.72, 91,837.45, and 90,439.36. Their average is 89,795.51.

    Read the results in the Average column under Oct 2026. The other repeated calculation columns show #ERR.
  3. In the image below, the Average calculation uses AVERAGE(2026-Q1 - 2026-Q4, 2025-Q1 - 2025-Q4) to calculate the average of the 2026 and 2025 annual values in each row.

    In row 1, 534,050.61 and 749,014.66 give an average of 641,532.64. This averages the two annual values, rather than the individual quarterly values.

COALESCE

COALESCE(value1, [value2…])

Returns the first non-empty value from a series of values, checking them in the order specified in the formula.

Use COALESCE when you want to use a value from one column but fall back to another column if the first is empty. For example, you can use a value from one period and fill gaps with values from another period. The source columns remain unchanged.

Inputs

  • value1: The first value or column to check.

  • [value2…]: Optional additional values or columns to check, in order.

Examples

  1. COALESCE([null, null, 1, 4, null]) returns 1, the first non-empty value.

  2. In the image below, the Coalesce calculation uses COALESCE(Jan 2025 - Nov 2025, Jan 2026 - Nov 2026) to return the 2025 value when available and use the 2026 value when the 2025 cell is empty.

    In row 1, the result is 417,169.02 from 2025. In row 5, the 2025 cell is empty, so the result is 415,750.24 from 2026. The order of the references in the formula determines which value is used, regardless of the columns' positions in the grid.

    COALESCE returns the 2025 value, with the 2026 value used for the empty 2025 cell in row 5.

DAYS

DAYS(coordinate)

Returns the number of days in a period or period range, including weekends.

Use DAYS when a calculation depends on the number of days in a period, such as calculating a daily cost over a period.

Input

coordinate: The period or period range to calculate the number of days for. You must specify a period. Leaving the input empty returns an error.

Examples

  1. DAYS(Jun 2024) returns 30, the number of days in June 2024.

  2. DAYS(Jul 2025 - Dec 2025) returns 184, the number of days from July to December 2025.

  3. In the image below, the Days in period calculation uses DAYS(01/09/2026 - 05/11/2026) to return 66, the number of days from September 1 to November 5, 2026, including both dates and weekends.

    Every row returns the same result because DAYS counts the days in the column's period, regardless of the values in each row.

    DAYS returns 66 for the period September 1 to November 5, 2026.

FINITE

FINITE(value, fallback, [-infinity], [+infinity])

Returns the original value if it is finite. If it is NaN (not a number), negative infinity, or positive infinity, returns the specified fallback value.

Use FINITE to replace non-finite calculation results with a value you choose, such as 0 when a calculation divides by zero.

Inputs

  • value: The number, column, or calculation to check.

  • fallback: The value to return for any non-finite result when using two inputs. When using four inputs, this is the value returned for NaN.

  • [-infinity]: The value returned for -infinity.

  • [+infinity]: The value returned for +infinity.

Use two inputs to return the same fallback for all non-finite results. Use four inputs to return different values for NaN, negative infinity, and positive infinity, in that order.

Examples

  1. FINITE(1/0, 0) returns 0 because dividing 1 by 0 produces a non-finite result.

  2. FINITE(-1/0, 1, 2, 3) returns 2, the value defined for -infinity.

  3. FINITE(NaN, 0) returns 0.

  4. In the image below, the FINITE calculation uses FINITE(Sep 2026 Value / 0, 0). Each value in the Sep 2026 Value column is divided by 0, producing a non-finite result. The fallback is 0, so every row displays 0.00.

    FINITE replaces each non-finite result of dividing the Sep 2026 Value column by zero with 0.

FORECAST.LINEAR

FORECAST.LINEAR(position, series)

Predicts a value at a given position in a series using linear regression, which fits a straight line to the known values.

Inputs

  • position: The position in the series to calculate the predicted value for. Positions start at 1. For example, use 5 to predict the next value after four known values.

  • series: The known values to use for the linear regression. Create the series with the ARRAY function or a range of columns.

Examples

  1. FORECAST.LINEAR(5, ARRAY(100, 200, 300, 400)) returns 500. ARRAY supplies the four known values. Position 5 predicts the next value in the series.

  2. In the image below, the Next quarter prediction calculation uses FORECAST.LINEAR(5, ARRAY(2026-Q1 Value, 2026-Q2 Value, 2026-Q3 Value, 2026-Q4 Value)) to predict Q1 2027 from the four quarterly values for 2026. The total prediction is 432,445.03, rounded to two decimal places.

    ARRAY supplies the four Value columns in order, from 2026-Q1 to 2026-Q4. Position 5 predicts the next quarter. Each row uses its own quarterly values to calculate its prediction.

    Read the results in the Next quarter prediction column under 2026-Q4. The other repeated calculation columns show #ERR.

IF

IF(logical expression, value if true, value if false)

Returns one value when a condition is TRUE and another value when it is FALSE.

A logical expression is a statement that evaluates to either TRUE or FALSE.

Inputs

  • logical expression: A statement that evaluates to either TRUE or FALSE.

  • value if true: The value returned if the logical expression is TRUE.

  • value if false: The value returned if the logical expression is FALSE.

Use this function for if-then-else logic, such as setting a sales-based discount threshold.

Examples

  1. In the image below, the IF calculation uses IF(Sep 2026 Value > 0, 1, 0) to return 1 when the value is greater than 0. If the value is zero or less, it returns 0.

    In row 1, the value is -6.26, so the result is 0. In row 6, the value is 7.34, so the result is 1.

    IF returns 0 for negative Sep 2026 values and 1 for positive values.
  2. IF(Sales > 7000000, Sales * 0.05, 0) returns 5% of sales when sales exceed 7 million. Otherwise, it returns 0.

  3. See the NOT example for how to use IF with NOT to flag counts that differ from an expected value.

  4. See the AND example for how to use IF with AND to check whether both weekly values are greater than 0.

  5. See the OR example for how to use IF with OR to check whether at least one weekly value is greater than 0.

MAX

MAX(value1, [value2…])

Returns the largest number in a set of values. When you reference multiple columns, it compares the values in each row and returns the largest value for that row.

Use MAX to find the highest value across periods or measures. For example, compare monthly sales columns to find each customer's highest monthly sales value over a selected period.

Inputs

  • value1: The first value, column, or column range to compare.

  • [value2…]: Optional additional values, columns, or column ranges to compare.

Examples

  1. MAX(-2, 5, 10) returns 10.

  2. MAX(Jul 2025 .. Dec 2025) returns the largest value in the range from July to December 2025.

  3. In the image below, the Max calculation uses MAX(Aug 2026 Value, Sept 2026 Value, Oct 2026 Value) to find each customer's highest monthly sales value across August, September, and October 2026.

    In row 1, the monthly values are 65,300.17, 91,005.30, and 89,560.44. The result is 91,005.30, the September value.

    MAX compares monthly sales from August to October 2026. Read the Max results under Aug 2026.
    Read the results in the Max column under Aug 2026. The other repeated calculation columns show #ERR.

MIN

MIN(value1, [value2…])

Returns the smallest number in a set of values. When you reference multiple columns, it compares the values in each row and returns the smallest value for that row.

Use MIN to find the lowest value across periods or measures. For example, compare monthly sales columns to find each customer's lowest monthly sales value over a selected period.

Inputs

  • value1: The first value, column, or column range to compare.

  • [value2…]: Optional additional values, columns, or column ranges to compare.

Examples

  1. MIN(-2, 5, 10) returns -2.

  2. MIN(Jul 2025 .. Dec 2025) returns the smallest value in the range from July to December 2025.

  3. In the image below, the Min calculation uses MIN(Aug 2026 Value, Sept 2026 Value, Oct 2026 Value) to find each customer's lowest monthly sales value across August, September, and October 2026.

    In row 1, the monthly values are 65,300.17, 91,005.30, and 89,560.44. The result is 65,300.17, the August value.

    MIN compares monthly sales from August to October 2026. Read the Min results under Aug 2026.
    Read the results in the Min column under Aug 2026. The other repeated calculation columns show #ERR.

NOT

NOT(condition1, [condition2…])

Reverses a logical result: TRUE becomes FALSE and FALSE becomes TRUE. Commonly used with the IF function.

Use NOT to flag values that do not meet a condition, such as counts that differ from an expected value.

Inputs

  • condition1: The first condition or value to evaluate.

  • [condition2…]: Optional additional conditions or values to evaluate.

NOT treats 0 as FALSE and any nonzero value, including a negative value, as TRUE. It returns 1 for TRUE and 0 for FALSE.

Examples

  1. NOT(1) returns 0 (FALSE). NOT(0) returns 1 (TRUE).

  2. In the image below, the NOT calculation uses NOT(IF(W35 2026 Count = 4, 1, 0)) to flag counts that differ from an expected value of 4.

    In row 1, Count is 4, so IF returns 1 (TRUE). NOT reverses this to 0 (FALSE). In row 6, Count is 3, so IF returns 0 (FALSE). NOT reverses this to 1 (TRUE).

    NOT flags W35 2026 counts that differ from 4. Row 1 returns 0 and row 6 returns 1.

OR

OR(condition1, condition2, [condition3]…)

Returns TRUE when at least one condition is TRUE, including when all conditions are TRUE. If all conditions are FALSE, it returns FALSE. Commonly used with the IF function.

Use OR to flag rows that meet at least one of several conditions. For example, identify customers with positive sales in either of two weeks.

Inputs

  • condition1: The first condition or value to evaluate.

  • condition2: The second condition or value to evaluate.

  • [condition3…]: Optional additional conditions or values to evaluate.

OR treats 0 as FALSE and any nonzero value, including a negative value, as TRUE. It returns 1 for TRUE and 0 for FALSE.

Examples

  1. OR(1, 0) returns 1 (TRUE) because at least one value is nonzero. OR(0, 0) returns 0 (FALSE) because both values are 0.

  2. In the image below, the OR calculation uses OR(IF(W35 2026 Value > 0, 1, 0), IF(W36 2026 Value > 0, 1, 0)) to check whether at least one of the two weekly values is greater than 0. Each IF function returns 1 when its column's value is greater than 0 and 0 otherwise.

    In rows 1 and 4, both weekly values are greater than 0, so OR returns 1. In rows 2, 3, 5, and 6, only one weekly value is greater than 0, so the result is also 1. In rows 7 to 10, neither weekly value is greater than 0, so the result is 0.

    OR returns 1 when W35 2026 or W36 2026 Value is greater than zero. Rows 7 to 10 return 0.

PERCENTILE

PERCENTILE(series, k)

Returns the value at a specified percentile in a series of numbers. The result can fall between values in the series.

Use PERCENTILE to calculate a benchmark from a set of values. For example, use 0.5 with monthly sales columns to find each customer's median monthly sales value.

Inputs

  • series: The values or columns to evaluate, grouped using the ARRAY function.

  • k: The percentile to calculate, expressed as a number from 0 to 1, inclusive. For example, 0.3 represents the 30th percentile and 0.5 represents the 50th percentile (the median).

Examples

  1. PERCENTILE(ARRAY(1, 2, 3, 4), 0.3) returns 1.9, the 30th percentile of the series. PERCENTILE(ARRAY(1, 2, 3, 4), 0.5) returns 2.5, the 50th percentile (the median).

  2. In the image below, the PERCENTILE calculation uses PERCENTILE(ARRAY(Sep 2026 1, Sep 2026 2, Sep 2026 3, Sep 2026 4), 0.3). The calculation columns named 1, 2, 3, and 4 contain those numbers in each row. ARRAY groups the four column values into the series, and 0.3 specifies the 30th percentile.

    Read the PERCENTILE results in the individual rows, where the result is 1.90. Changing the second input to 0.5 would return 2.50. The total row displays #ERR in this screenshot.

    PERCENTILE uses ARRAY to group columns containing 1, 2, 3, and 4. The 30th percentile is 1.90 in each detail row.

PERIODCOUNT

PERIODCOUNT(column)

Returns the number of periods, such as months or days, associated with a column.

Use PERIODCOUNT when a calculation depends on how many periods a column covers, such as calculating an average value per month.

Input

column: The transaction column to find the period for.

Example

In the image below, the PERIODCOUNT calculation uses PERIODCOUNT(Oct 2025 - Sep 2026) to return 12. The selected column covers October 2025 to September 2026 and contains 12 monthly periods.

Every row displays 12.00 because the number of periods depends on the column's period range, rather than the values in each row.

PERIODCOUNT returns 12 for the 12 monthly periods from October 2025 to September 2026.

POWER

POWER(base, exponent)

Returns a number raised to a power.

Use POWER to calculate repeated growth. For example, if a quantity doubles each period, POWER(2, 3) gives a growth factor of 8 after three periods. Multiply the starting quantity by this factor to calculate the final quantity.

Inputs

  • base: The number or column to raise to a power.

  • exponent: The power to raise the base to.

Examples

  1. POWER(2, 3) returns 8, because 2 raised to the power of 3 is 2 × 2 × 2 = 8.

  2. In the image below, the POWER calculation uses POWER(Sep 2026 2, 3) to raise each value in the calculation column named 2 to the power of 3. Each row contains 2.00, so every result is 8.00.

    POWER raises each value of 2 in the Sep 2026 calculation column to the power of 3 and returns 8.00.

RANK

RANK(value, [series])

Assigns a rank to a value based on how large it is compared to other values. The largest value receives rank 1.

Use RANK to compare performance. For example, rank customers by sales within a column, or see how a customer's sales for one month compare with their sales in other months.

Inputs

  • value: The value or column to rank.

  • [series]: An optional series to rank the value against. Create the series using the ARRAY function.

Examples

  1. RANK(Oct 2026 Value) ranks the October values within their own column. The customer with the highest October value receives rank 1.

  2. In the image below, the October sales rank calculation uses RANK(Oct 2026 Value, ARRAY(Aug 2026 Value, Sept 2026 Value)) to rank October sales against August and September sales for each customer. The comparison is within each row, rather than between customers.

    In row 1, October sales of 89,560.44 rank 2, below September but above August. In row 2, October ranks 1, the highest of the three months. In row 9, October ranks 3, the lowest.

    October sales rank compares October sales with August and September for each customer. Rows 1, 2, and 9 rank 2, 1, and 3.
    Read the results in the October sales rank column under Oct 2026. The other repeated calculation columns show #ERR.

ROUND

ROUND(value, places)

Rounds a number to a specified number of decimal places.

Use ROUND to control the precision of values used in further calculations.

Inputs

  • value: The value or column to round.

  • places: The number of decimal places to round to. Use 0 for whole numbers, a positive number for decimal places, or a negative number for tens, hundreds, and so on.

Use ROUND when other calculations should use a rounded value. Use Number format in the column menu when you only want to change how values are displayed. Changing the number format leaves the value used in calculations unchanged.

Examples

  1. ROUND(2.558, 1) returns 2.6.

  2. ROUND(1234, -3) returns 1000.

  3. In the image below, the Rounded value calculation uses ROUND(Value, 0) to round each value to a whole number.

    In row 1, 245,865.91 becomes 245,866. It displays as 245,866.00 because the column's number format shows two decimal places.

    ROUND(Value, 0) rounds each value to a whole number. Row 1 displays 245,866.00 because the number format shows two decimal places.

    To hide the decimal places, open the Rounded value column menu and select Number format, then choose a format with no decimal places. In the image below, selecting 1235 displays the first result as 245866, without a thousands separator. This changes the display only.

    Choose the 1235 number format from the Rounded value column menu to display whole numbers without decimal places or thousands separators.

SQRT

SQRT(value)

Returns the positive square root of a positive number.

Use SQRT when a calculation requires a square root. For example, calculate the side length of a square from its area: an area of 25 square meters gives a side length of 5 meters.

Input

value: The number or column for which to calculate the square root.

Examples

  1. SQRT(4) returns 2, because 2 × 2 = 4.

  2. In the image below, the SQRT calculation uses SQRT(Sep 2026 4) to calculate the square root of each value in the calculation column named 4. Every row contains 4.00, so every result is 2.00.

    SQRT uses the Sep 2026 calculation column named 4. Every row contains 4.00 and returns 2.00.

SUM

SUM(value1, [value2…])

Adds numbers, columns, or column ranges. When you reference multiple columns, it adds the values in each row.

Use SUM to combine values from selected columns, such as calculating a customer's total sales or transaction count across several months.

Inputs

  • value1: The first number, column, or column range to include in the sum.

  • [value2…]: Optional additional numbers, columns, or column ranges to include in the sum.

Examples

  1. SUM(1, 2, 3) returns 6.

  2. In the image below, the SUM calculation uses SUM(Jun 2026 Count, Jul 2026 Count, Aug 2026 Count) to add the three monthly Count values for each customer. Select each month's Count column header to include it in the formula.

    In row 1, the monthly counts are 5, 5, and 5, giving a total of 15.

    SUM adds June, July, and August 2026 Count values in each row. Read the SUM results under Jun 2026.
    Read the results in the SUM column under Jun 2026. The other repeated calculation columns show #ERR.
  3. In the image below, the Sum Aug and Oct calculation uses SUM(Aug 2026 Value, Oct 2026 Value) to combine sales for two selected months. September's value is excluded because its column is not included in the formula.

    In row 1, August sales of 39,594.81 plus October sales of 93,147.65 give a total of 132,742.46.

    Sum Aug and Oct adds August and October sales for each customer, excluding September. Row 1 returns 132,742.46 under Aug 2026.
    Read the results in the Sum Aug and Oct column under Aug 2026. The other repeated calculation columns show #ERR.

WORKINGDAYS

WORKINGDAYS(id, columns)

Returns the number of working days in a column's period or period range, as defined by the selected working days calendar.

Use WORKINGDAYS to calculate values per working day, such as average daily sales, using the calendar relevant to your business.

You need to set up working day calendars to use this function.

Inputs

  • id: The working days calendar to use. Select it from the list of available calendars.

  • columns: The column or column range that supplies the period. Select a column associated with the period you want to count. Its measure and values do not affect the result. Leaving this input empty returns an error.

If you change the period associated with the selected column, the result updates to reflect the working days in the new period.

Steps

  1. Select the WORKINGDAYS function to display the list of available calendars.

  2. Select the calendar you want to use.

    Select a working days calendar by name from the list, such as Working Days Excl Bank Holidays.
  3. Select the column header associated with the required period.

  4. Press Enter to apply the calculation.

Example

In the image below, the Working days excl hols calculation uses WORKINGDAYS(Working Days Excl Bank Holidays, Aug 2026 Value). The first input selects the calendar named Working Days Excl Bank Holidays. The second input selects the Value column for Aug 2026.

In this example, the selected calendar defines 21 working days in August 2026, 22 in September, and 22 in October. Each repeated calculation uses its month's period. Every row within a month returns the same result because the sales values do not affect the working day count. Results depend on how the selected calendar is set up.

The selected working days calendar returns 21 working days for August 2026 and 22 for September and October.

To count all days in a period, including weekends, see DAYS.

Last updated