Calc KEY function

The KEY function returns the key at a given index (indexes are zero-based).

Help CentreFunctions & Formulas

For a full list of available calculation functions, please read What calculation functions are supported.


Description

The KEY function is used to retrieve the key at a specified index from a collection or dictionary. The indexes are zero-based, meaning the first key is at index 0.


Syntax

KEY(collection, index)


The KEY function syntax has the following arguments:

  • collection - Required. The collection or dictionary from which you want to retrieve the key.
  • index - Required. The zero-based index of the key you want to retrieve.

Example

FormulaDescriptionResult
=KEY({"a": 1, "b": 2, "c": 3}, 1)Retrieves the key at index 1 from the collectionb
=KEY({"x": 10, "y": 20}, 0)Retrieves the key at index 0 from the collectionx

Errors

For a full list of formula errors, please read Formula errors.


Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.