Forum Discussion
Conversion of 'Complex' Google sheet to Excel
PowerQuery is the purpose-written system for such ETL (extract/transform/load) activities associated with Excel. The Excel formula environment has little in the way of array-reshaping functions but Excel 365 does enable such tasks to be performed from first principles. In this case
= LET(
m, ROWS(Table1),
n, COLUMNS(Table1)-1,
k, SEQUENCE(m*n),
c, 1+MOD(k-1,n),
r, 1+QUOTIENT(k-1,n),
dt, INDEX(--date, 1, c+1),
rsrce, INDEX(Resource,r),
value, INDEX(Table1,r,c+1),
unpivotted, CHOOSE({1,2,3},rsrce,dt,value),
FILTER(unpivotted, NOT(ISBLANK(value)))
)will unpivot the data table and remove blank records. In the most recent versions of Excel, this can be presented in the form of Lambda functions which wrap the 'nuts and bolts' aspect of the calculation within more meaningful function calls. It is also possible to deal with higher dimensionality data (nested arrays of arrays) using Lambda functions. As an alternative, Charles Williams provides an UNPIVOT function within the FastExcel add-in. This will take data from a cross-tab to normalised form as well as managing headers.