Functions Utility

SubstituteArray

The SubstituteArray() function is used to replace values in a data range with a specified value. The values to be replaced are supplied in a separate list.

Related functions: ArrayToString, StringToArray, TransposeArray, Null


Syntax:

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

RangeThe string to be split.
Replacement Value
(optional)
The value that will replace matches found in the input range.
Value List
(optional)
The list of values to be replaced.
This can be a range, an array, or explicit values.

Remarks:

  • The default parameters are:
    • Replacement Value: Empty string
    • Value List: An array of all Excel error values (e.g., #NAME?, #DIV/0!, #NULL!, etc.)

Examples:

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

> Example 1: Replacing specified values with another value


Range (A1:B5):

Task 110%
Task 299%
Task 3100%
Task 445%
Task 585%

Values to replace (D1:D3):

98%
99%
100%

Replace all percentages ≥ 98% with Completed. Function call:

=Qx.SubstituteArray(A1:B5, "Completed", D1:D3) 

Result:

Task 110%
Task 2Completed
Task 3Completed
Task 445%
Task 585%
> Example 2: Replacing Excel errors with an empty string


Range (A1:D4):

ABS100%FALSE2020
#NAME?#DIV/0!TRUE#NUM!
ACOS30%TRUE2020
#N/A#DIV/0!#NULL!2000

Using default parameters removes error values. Function call:

=Qx.SubstituteArray(A1:D4)

Result:

ABS100%FALSE2020
TRUE
ACOS30%TRUE2020
2000