04 UnPivot - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki
UnPivot method
Unpivots data into an ArrData object. Returns True if successful, otherwise False.
Applies to
| TableData | ArrData | RsetData | Xdata | XShared |
|---|---|---|---|---|
| ✓ |
Parameters
| Name | Type | Description |
|---|---|---|
| Xd | Any Xdata object | Source of the data to unpivot. |
| PivotField | Variant | Name or number of the field to contain the unpivoted field names of Xd. |
| DataField | Variant | Name or number of the field which will contain the data values from these fields. |
| JoinFields | Value, array or ParamArray | Fields to be copied from Xd without being unpivoted. |
Data in crosstab format in any Xdata object can be unpivoted using UnPivot into a new ArrData object. The user specifies the pivot field, the data field and the join fields, all of which must already exist on the target ArrData object.
Data in the join fields (if any) is copied across, then every other field in the source Xdata object is assumed to be a field to be unpivoted, and where there is a value which is not 0 (numeric), an empty string (text) or false (boolean) a record is created with the original heading in the pivot field and the value in the data field.