/* FUNCTION NAME: ExtractYrDataλ
DESCRIPTION: Looks up and extracts 1 year's data from table as a thunk*/
/* REVISIONS: Date Developer Description
27 Apr 2024 Peter Bartholomew Original Development
*/
ExtractYrDataλ = LAMBDA(
//Parameter Declarations
hdr, //Header row to crosstab table
body, //Body of crosstab table
LAMBDA(
yr, //Year of data to be extracted
LAMBDA(
LET(
firstField, XLOOKUP(yr&"*", hdr, body,,2, 1),
finalField, XLOOKUP(yr&"*", hdr, body,,2,-1),
IFERROR(HSTACK(yr, firstField:finalField), "")
)
)
))