Contact

COLUMNS Function (OpenOffice Calc)

Lookup Intermediate OpenOffice Calc

Learn the COLUMNS function in Apache OpenOffice Calc: Returns the number of columns in an array or reference.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Availability and version history

  • Introduced: Documented by Apache OpenOffice 4.1.16; original introduction not established.
  • Availability: Supported in Apache OpenOffice 4.1.16, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

COLUMNS returns the width of a reference or array. It counts positions, not populated fields. A1:C5 has three columns and fifteen cells; its height does not change the COLUMNS result. Empty, hidden or text-filled columns still occupy positions in that explicit range.

Syntax and arguments

=COLUMNS(reference_or_array)

The documented function takes one reference, named reference or array. A single cell has one column. For an ordered rectangle on one sheet, subtract the first column coordinate from the last and add one. The source reads endpoints or matrix dimensions rather than searching the contents of each cell. Examples use English function names and semicolon separators.

Worked example

Use this small practice sheet for the ranges referenced in the formula:

Row A (Quantity) B (Amount) C (Category)
1 1 10 apple
2 2 20 pear
3 3 30 apple
4 4 40 pear
5 5 50 apple
=COLUMNS(A1:C5)

Expected result: 3.

Why it works: Count the number of columns in a selected range. The specified sample table supplies the referenced cells.

Example evidence

This original example retains its historical comparable LibreOffice 25.2 checking scope; it was not an OpenOffice native test. The reference controls below are independently checked source/documentation expectations, not new application captures.

Additional reference controls

Formula Reference result
=COLUMNS(A1:C5) 3
=COLUMNS(D8) 1
=COLUMNS(A3:B5) 2
=COLUMNS(G4:H4) 2
=COLUMNS(A2:A8) 1
=COLUMNS(Z1:AB1) 3

Quoted results are text. ERROR means the source’s error path without claiming a newly observed localized error message. Range formulas here use ordinary scalar entry unless the array form is explicitly discussed.

Practical worksheet

Use the original A1:C5 practice table. In E1 enter =COLUMNS(A1:C5) to obtain 3. In E2 enter =ROWS(A1:C5) to obtain 5. Their product is 15 cells. Removing the values in column B does not make the range two columns wide; B remains inside the endpoints.

For a horizontal counter, put =COLUMNS($D$2:D2) in D4 and copy across through H4. Results are 1,2,3,4,5 because the right endpoint moves while the left stays anchored. The counter measures a growing horizontal span and is not an identifier stored with the source data.

Advanced applications and distinctions

Check alphabet transitions. Z1:AB1 includes Z, AA and AB, so its width is 3. The equivalent coordinate arithmetic is COLUMN(AB1)-COLUMN(Z1)+1=28-26+1. Treating the labels as simple single letters would fail across this boundary.

Understand multiple-area names. For a named reference consisting of A1:A3 and C1:D4, the official documentation gives COLUMNS=3: one column plus two columns. Shared column positions in other multi-area arrangements are counted per area rather than deduplicated. The result describes a sum of area widths, not necessarily the width of one contiguous bounding rectangle.

Keep matrix axes straight. A two-column, three-row array has COLUMNS=2 and ROWS=3. The source matrix path reads these dimensions directly. Transposing such an array swaps the two counts, but native array entry and transposition were not executed as part of these reference checks.

Errors and troubleshooting

Use actual references rather than quoted text such as “A1:C5”. Unsupported scalar/text argument types follow the checked illegal-parameter path, and broken references must be corrected. The guide does not invent a native error code or treat every invalid input as a zero-width range.

A table with three visible populated fields may still include additional blank or hidden columns in its reference. COLUMNS counts those positions too. If a field count depends on header content or on visibility, that needs a separate explicit rule.

Multiply COLUMNS by ROWS to count cells only for a simple rectangular region. Doing so with dimensions summed over a multi-area name can count combinations that do not exist. The ordinary examples use one sheet, bounded ranges and stable endpoints; multi-sheet and external references have additional behavior. Copying and structural edits should be checked separately because inserting a column can change the endpoints and width even when some addresses contain dollar signs.

Documentation and verification

The official COLUMNS function reference was retrieved October 15, 2026. The pinned 4.1.16 interpreter and function descriptions retain their October 13 source retrieval dates. These support scalar branch selection, reference dimensions, lookup modes and the limitations stated here. Original introduction and last functioning version remain unestablished, separate from documented release support. No new native, GUI, array-entry or import/export test was performed.