Henn Sarv
I see from your proposed solution that I mis-read the initial data, taking the spaces as string separators rather than separate columns. That modifies my solution since I cannot pass a 2D table to REDUCE; it either has to be a thunk array or an index. Using an index, I get
WorksheetFormula
= REDUCE(Header, {1;2}, Unpackλ)
Header = {"Name","Year","Value"};
Unpackλ
= LAMBDA(acc,r,
LET(
terms, CHOOSEROWS(Table1,r),
initialTerms, DROP(terms,,-1),
finalTerm, TAKE(terms,,-1),
values, VALUE(TEXTSPLIT(@finalTerm, ,",")),
newRows, HSTACK(IF(values,initialTerms),values),
VSTACK(acc, newRows)
)
);
Since that leaves both the table name and the row index hard-wired into the function I would normally wrap it in a further Lambda in order to pass the name as a parameter.
That could be done with
WorksheetFormula
= Normaliseλ(Table1)
Normaliseλ = LAMBDA(table,
REDUCE(Header, SEQUENCE(ROWS(table)), Unpackλ))