I want this formula to be dynamic. let it reads the column name from a cell. columns: LOB from b12. Tier from b13. sub b14. configuration from b15. color b16. =LET(
jarir, D2,
extra, D3,
branded, D4,
unbranded, D5,
primaryLOB, C12,
primaryTier, 13,
primarySSub, 14,
primaryConfig, 15,
primaryColor, 16,
sumCriteria, LAMBDA(hq,prog,
IF(AND( NOT(6), NOT(7) ),
To make your formula dynamic so that it reads the column names from the specified cells (B12, B13, B14, B15, B16), you'll need to replace the fixed references to the column names within the SUMIFS functions with the INDEX and MATCH constructs. This allows you to refer to the column headers dynamically based on the values in those cells.
Here’s how you can adapt your existing formula to use that approach:
In this modified formula, I've replaced the references to the fixed cells for LOB ($C$12), Tier ($C$13), Sub ($C$14), Configuration ($C$15), and Color ($C$16) with dynamic references to B12, B13, B14, B15, and B16, respectively.
Make sure that the values in those cells (B12 to B16) accurately match the header names used within your lastQ table for the SUMIFS functions to work properly. If there is a mismatch, you may get zero or incorrect results.