Text Concatenation Operator: &
4.6 • 5.0 • 5.1 • 5.2 • 5.3 • 5.4 • 6.0 • 6.1 • 6.2 • 6.3 • 6.4
A & B
Evaluates «A» and «B», coerces their element values to text, and concatenates the result.
Concatenating numeric values
When concatenating numeric values to text, a number format is required to determine how the numbers should be rendered as text, what precision should be depicted, etc. The number format for the variable or User-Defined Function being evaluated is used. Only the number format for the whole variable is used -- if you have set cell-level formats (such as a different number format for a particular slice), this does not impact the behavior of the number-to-text coercion. If in doubt, you can use the NumberToText function to control the format of converted numbers before applying the & operator.
When you are concatenating numeric values, a much better option is to use a Formatted Text Literal, which results in a more readable expression and you can easily control the number format.
'Hello' & ' ' & 'world' → 'Hello world'
5 & 2 → '52'
['a', 'b'] & 'c' → ['ac', 'bc']
The need to coerce numbers to text using a particular format often arises. Instead of having to rely on setting the number format for the variable that you are defining for this purpose, you can use the NumberToText function.
Enable comment auto-refresher