Functions Utility

Transform

The Transform() function takes an input range, performs one or more calculations on that data, and returns the specified columns.


Syntax:

Qx.Transform(Range, Formulas, [Calculate Error Value])
  • In Excel with Quintessence add-in versions prior to 25.1, use: Transform()
  • In the Quintessence Editor (Studio) using Quintessence language, use: Transform()
  • In the Quintessence Editor (Studio) using Python language, use: Qx.Transform()
 See parameter descriptions

RangeThe input range.
FormulasThe formulas or calculations to apply to the input.
Within formulas, columns are referenced as C1, C2, C3, etc.

If the first row contains headers, header notation may also be used.
For example, if a column header is Price, reference it as [Price].
Calculate Error Value
(optional)
The value to display when a formula fails.

Remarks:

  • Default values:
    • Calculate Error Value: returns a blank result.

Examples:

The examples provided below are based on fictitious data for illustrative purposes only.

> Example 1: Simple evaluations returning TRUE or FALSE


Range (A1:C3):

123
456
789

Determine whether each entry is divisible by 2.

Formula:

=Qx.Transform(A1:C3, "mod(C1,2)=0, mod(C2,2)=0, mod(C3,2)=0")

Result:

FALSETRUEFALSE
TRUEFALSETRUE
FALSETRUEFALSE
> Example 2: Using Transform with a K=Series


A K=Series allows you to apply the same instruction to multiple adjacent columns. The word Columns refers to the total number of columns. For example, to reference the second‑last column, use Columns-1.

Range (A1:C3):

123
456
789

Determine whether each entry is divisible by 2.

Formula:

=Qx.Transform(A1:C3, "k=series(1,Columns):mod(Ck,2)=0")

Result:

FALSETRUEFALSE
TRUEFALSETRUE
FALSETRUEFALSE
> Example 3: 2‑point rolling average using RC reference syntax


Range (A1:C3):

123
456
789

Calculate the rolling average of pairs of consecutive values in column 1. If a row does not have enough data points, return the text Insufficient data points.

Formula:

=Qx.Transform(A1:C3, "average(r(line-1)C(1):R(line)C(1))", "Insufficient data points")

Result:

Insufficient data points
2.5
5.5
> Example 4: Continued calculation using output. syntax


Range (A1:C3):

123
456
789

Calculation is required where:

  • Column 1:
    Sum the current row with the previous row. For the first row, take the value as is:
    if(line=1, C1, sum(r(line-1)C(1):r(line)C(1)))
  • Column 2:
    Divide the original column value by the newly calculated value, using output. syntax to reference the result from Column 1. Round up to 2 decimal places:
    roundup(C1/output.C1 * 100, 2)

Formula:

=Qx.Transform(A1:C3, "if(line=1, C1, sum(r(line-1)C(1):r(line)C(1))), roundup(C1/output.C1 * 100, 2)")

Result:

11.00
50.80
110.64