modify this, when d8 are false, ignore this criteria and return the results with out it: =LET( jarir, $D$2, extra, $D$3, branded, $D$4, unbranded, $D$5, primaryLOB, $C$13, primaryTier, $C$14, primarySSub, $C$15, primaryConfig, $C$16, primaryColor, $C$17, regionCriteria, IF($D$8, lastQ[[Region]:[Region]], ""), sumCriteria, LAMBDA(hq,prog, IF(AND( NOT($D$6), NOT($D$7) ), SUMIFS( lastQ[W1], lastQ[[Measure]:[Measure]], $AB$10, 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, regionCriteria,C8), IF(AND($D$6, $D$7), SUM( SUMIFS( lastQ[W1], lastQ[[Measure]:[Measure]], $AB$10, 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, regionCriteria,C8), SUMIFS( lastQ[W1], lastQ[[Measure]:[Measure]], $AB$10, 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, regionCriteria,C8) ), IF($D$6, SUMIFS( lastQ[W1], lastQ[[Measure]:[Measure]], $AB$10, 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, regionCriteria,C8), IF($D$7, SUMIFS( lastQ[W1], lastQ[[Measure]:[Measure]], $AB$10, 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, regionCriteria,C8), 0 ) ) ) ) ), result, IF($D$8, 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", ""))) ), "" ) ) ), 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 )