Calc/Features/array constants in formulas

From Apache OpenOffice Wiki
< Calc‎ | Features
Jump to: navigation, search

Array constants are implemented with i32342 in CWS jgarrays


Calc now supports inline matrix/array constants in formulas. An inline array is surrounded by curly braces '{' and '}'. Elements can be each a number (including negatives), a logical constant (TRUE, FALSE) or a literal string. Non-constant expressions are not allowed. Arrays can be entered with one or more rows, and one or more columns. All rows must consist of the same number of elements, all columns must consist of the same number of elements, so that a two-dimensional array has no sparse elements. The column separator (separating elements in one row) is the ';' semicolon, the row separator is a '|' pipe symbol. They were chosen because the upcoming ODF formula specification uses these separators. Contrary to Excel, the separators are not UI-version and/or locale dependent. Arrays can not be nested. Import/export from/to Excel are implemented.


An array with one row consisting of the three numbers 1, 2 and 3.
An array with two rows and three values in each row.
A mixed data array.
Entered as a matrix formula delivers the result of three SIN calculations with the arguments 1, 2 respectively three.
Invalid array, the first row misses an element. This results in Err:512 "Formula overflow".
Invalid array, the second element is not a constant. This results in Err:512 "Formula overflow".
Invalid array, nested arrays are not allowed. This results in Err:533 "Nested arrays are not supported". This is a new error condition relevant for translation.
Personal tools