Help Centre › Building Processes
This article describes the RPA Excel functionality to unpivot (melt) columns from wide to long format.
For a full list of available functions, please read EXCEL functions.
Description
The Unpivot columns function converts wide-format data into long format (also known as melt or unpivot). You specify which columns to keep as identifiers – all remaining columns are "melted" into two new columns: one for the original column name (Variable) and one for the cell value (Value). The result is written to a new sheet.
Example
With ID columns: "Product"
| Before (wide format) | |||
|---|---|---|---|
| Product | Jan | Feb | Mar |
| Widget | 100 | 150 | 200 |
| Gadget | 80 | 90 | 110 |
| After (long format) | ||
|---|---|---|
| Product | Variable | Value |
| Widget | Jan | 100 |
| Widget | Feb | 150 |
| Widget | Mar | 200 |
| Gadget | Jan | 80 |
| Gadget | Feb | 90 |
| Gadget | Mar | 110 |
Setting it up
To use the Unpivot columns function, follow these instructions:
{{popups:rpas/add:action=excel-unpivot}}
Once on a process map:
- Navigate to the process where you would like to add the function
- Click on the green button’s drop-down
- Click on “+ Activity”
- Select the EXCEL Unpivot columns option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| ID columns | Yes | Textarea | - | The columns to keep as identifiers (one per line). All other columns will be unpivoted. |
| Variable column name | No | Text | Variable | Name for the new column containing the original column headers |
| Value column name | No | Text | Value | Name for the new column containing the cell values |
| Destination sheet | No | Text | (auto) | Name of the new sheet for the unpivoted data |
Output
This function creates a new sheet with the unpivoted data. The original sheet is not modified.
Tips
- This is the reverse of a pivot table – use it to normalise data for databases or reporting tools
- List all columns that should stay as-is (identifiers) in the ID columns field – everything else gets melted
- Common use case: converting monthly columns (Jan, Feb, Mar…) into rows with a Month column