# UNPIVOT

#### Syntax

**UNPIVOT**(*range; headerRange; numRowElements*)

1. *range* - the range whose content should be converted from a pivot structure into a row-based structure - ***Value type**: a range of any data*
2. *headerRange* - a range containing the column attributes of the pivot range - ***Value type**: a range of any data*
3. *numRowElements* - specifies how many starting columns from *range* should be used for the rows of the result range - ***Value type**: integer (optional, default value: 1)*

#### Remark <a href="#remarks.30" id="remarks.30"></a>

* The function converts the pivot structure of *range* into a row-based structure, with the help of the attribute names of *headerRange*.

#### Examples

**Example 1** - UNPIVOT with one attribute row and one attribute column (in the #header widget). The cell “Country” in the header is ignored, because it is assigned to the row attribute.

<figure><img src="https://3148043601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL43fiRbeRtPnTjMpbGNO%2Fuploads%2Fgit-blob-180cf449238ccc446248e331734446af9324b908%2Fimage%20(2).png?alt=media" alt=""><figcaption></figcaption></figure>

**Example 2** - UNPIVOT with two row attributes.

<figure><img src="https://3148043601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL43fiRbeRtPnTjMpbGNO%2Fuploads%2Fgit-blob-0237306aad4007423393d3cab9b1b197c00b00d5%2Fimage%20(3).png?alt=media" alt=""><figcaption></figcaption></figure>
