hi. im using this excel formula, I need to modify it to: reads the name for LastQ columns LOB/Tier/Sub/Configuration/Color from b12 to b16. I want the column name to be dynamic. make the formula without losing any criteria possibilities, while focusing on making it optimized and fast. =LET(
  jarir,         $D$2,
  extra,         $D$3,
  branded,       $D$4,
  unbranded,     $D$5,
  primaryLOB,    $C$12,
  primaryTier,   $C$13,
  primarySSub,   $C$14,
  primaryConfig, $C$15,
  primaryColor,  $C$16,
  sumCriteria, LAMBDA(hq,prog,
    IF(AND( NOT($D$6), NOT($D$7) ),

      SUMIFS(
        lastQ[W1],
        lastQ[[Measure]:[Measure]], $AB$9,
        lastQ[[LOB]:[LOB]], primaryLOB,
        lastQ[[Tier]:[Tier]], primaryTier,
        lastQ[[HQ]:[HQ]], hq,
        lastQ[[Sub]:[Sub]], primarySSub,
        lastQ[[Configuration]:[Configuration]], primaryConfig,
        lastQ[[Color]:[Color]], primaryColor,
        lastQ[[Programm]:[Programm]], prog
      ),
      IF(AND($D$6, $D$7),
        SUM(
          SUMIFS(
            lastQ[W1],
            lastQ[[Measure]:[Measure]], $AB$9,
            lastQ[[LOB]:[LOB]], primaryLOB,
            lastQ[[Tier]:[Tier]], primaryTier,
            lastQ[[HQ]:[HQ]], hq,
            lastQ[[Sub]:[Sub]], primarySSub,
            lastQ[[Configuration]:[Configuration]], primaryConfig,
            lastQ[[Color]:[Color]], primaryColor,
            lastQ[[Programm]:[Programm]], prog,
            lastQ[[STM+]:[STM+]], $C$6
          ),
          SUMIFS(
            lastQ[W1],
            lastQ[[Measure]:[Measure]], $AB$9,
            lastQ[[LOB]:[LOB]], primaryLOB,
            lastQ[[Tier]:[Tier]], primaryTier,
            lastQ[[HQ]:[HQ]], hq,
            lastQ[[Sub]:[Sub]], primarySSub,
            lastQ[[Configuration]:[Configuration]], primaryConfig,
            lastQ[[Color]:[Color]], primaryColor,
            lastQ[[Programm]:[Programm]], prog,
            lastQ[[STM+]:[STM+]], $C$7
          )
        ),
        IF($D$6,

          SUMIFS(
            lastQ[W1],
            lastQ[[Measure]:[Measure]], $AB$9,
            lastQ[[LOB]:[LOB]], primaryLOB,
            lastQ[[Tier]:[Tier]], primaryTier,
            lastQ[[HQ]:[HQ]], hq,
            lastQ[[Sub]:[Sub]], primarySSub,
            lastQ[[Configuration]:[Configuration]], primaryConfig,
            lastQ[[Color]:[Color]], primaryColor,
            lastQ[[Programm]:[Programm]], prog,
            lastQ[[STM+]:[STM+]], $C$6
          ),
          IF($D$7,

            SUMIFS(
              lastQ[W1],
              lastQ[[Measure]:[Measure]], $AB$9,
              lastQ[[LOB]:[LOB]], primaryLOB,
              lastQ[[Tier]:[Tier]], primaryTier,
              lastQ[[HQ]:[HQ]], hq,
              lastQ[[Sub]:[Sub]], primarySSub,
              lastQ[[Configuration]:[Configuration]], primaryConfig,
              lastQ[[Color]:[Color]], primaryColor,
              lastQ[[Programm]:[Programm]], prog,
              lastQ[[STM+]:[STM+]], $C$7
            ),
            0
          )
        )
      )
    )
  ),
  result,
    IF(AND(jarir, extra),
      SUM(
        IF(AND(branded, unbranded),
          sumCriteria("Jarir", "Branded") + sumCriteria("Jarir", "Unbranded"),
          sumCriteria("Jarir", IF(branded, "Branded", IF(unbranded, "Unbranded", "")))
        ),
        IF(AND(branded, unbranded),
          sumCriteria("extra", "Branded") + sumCriteria("extra", "Unbranded"),
          sumCriteria("extra", IF(branded, "Branded", IF(unbranded, "Unbranded", "")))
        )
      ),
      IF(jarir,
        IF(AND(branded, unbranded),
          sumCriteria("Jarir", "Branded") + sumCriteria("Jarir", "Unbranded"),
          sumCriteria("Jarir", IF(branded, "Branded", IF(unbranded, "Unbranded", "")))
        ),
        IF(extra,
          IF(AND(branded, unbranded),
            sumCriteria("extra", "Branded") + sumCriteria("extra", "Unbranded"),
            sumCriteria("extra", IF(branded, "Branded", IF(unbranded, "Unbranded", "")))
          ),
          ""
        )
      )
    ),
  result
)