dimanche 26 janvier 2020

Insert range using IF formula in SUMIF function with multiple criteria (using arrayformula)

I am using arrayformula with my sumif function which has several criterion and ranges to expand automatically across a set column (B). The formula below works perfectly:

=ARRAYFORMULA(SUMIF('DATA'!$N:$N&'DATA'!$U:$U&'DATA'!$V:$V&'DATA'!$BV:$BV,$B$6:$B&$E$30&$D$26&$C$36,'DATA'!$AG:$AG).

I want to make it more dynamic and insert an IF statement to actually refer to a range vs another based on certain conditions. For ex,

IF($A$6:$A=XX,'DATA'!$N:$N,'DATA'!$M:$M).

The formula then breaks if I do this

=ARRAYFORMULA(SUMIF(IF($A$6:$A=XX,'DATA'!$N:$N,'DATA'!$M:$M)&'DATA'!$U:$U&'DATA'!$V:$V&'DATA'!$BV:$BV,$B$6:$B&$E$30&$D$26&$C$36,'DATA'!$AG:$AG).

Any way/workaround to make it work? I tried multiple times, read multiple forums but can't find an answer.

Aucun commentaire:

Enregistrer un commentaire