Forum Discussion
Calheiro
May 20, 2024Copper Contributor
Dinamically Return Values From a Column Using A Merged Header Above It as Conditional
Hi, everyone! I need some help with a formula. See, I have the table layout as shown above and I need the "CS Month" (FM) column to return the values from daily CS+IN (Row 2) column dinamical...
- May 20, 2024
PeterBartholomew1
May 20, 2024Silver Contributor
An advantage of using 365 is that array shaping functions are available to use as part of the calculation. For example the following generates an array containing the CS+IN columns only, each with the appropriate date header.
= LET(
dateHdr, TAKE(WRAPCOLS(date, 5),1),
wrapped, WRAPROWS(TOCOL(stock),5),
CS, WRAPROWS(TAKE(wrapped,, -1), COUNT(date)),
XLOOKUP(csMonth, dateHdr, CS)
)From there, lookups should be simple. Whilst developing the formula the intermediate variables can be output to scratch space as helper ranges but, once everything is up and going, these can be removed.