Simplemountain
New Member
- Joined
- Feb 26, 2016
- Messages
- 27
Consider the following formula:
=IF(
SUM(
IF(N6=AB40,(SUMIFS(S7:AD7,$S$6:$AD$6,X41))),
IF(N8=AB40,(SUMIFS(S9:AD9,$S$8:$AD$8,X41))),
IF(N10=AB40,(SUMIFS(S11:AD11,$S$10:$AD$10,X41))),
IF(N12=AB40,(SUMIFS(S13:AD13,$S$12:$AD$12,X41))))=0,"",
SUM(
IF(N6=AB40,(SUMIFS(S7:AD7,$S$6:$AD$6,X41))),
IF(N8=AB40,(SUMIFS(S9:AD9,$S$8:$AD$8,X41))),
IF(N10=AB40,(SUMIFS(S11:AD11,$S$10:$AD$10,X41))),
IF(N12=AB40,(SUMIFS(S13:AD13,$S$12:$AD$12,X41)))))
For the first line, the formula first evaluates if N6=AB40. If this is true, then it looks at the range S6:AD6 and compares it to the value in X41. If the value anywhere in this range is equal to X41 then it sums the corresponding numerical cell below it in range S7:AD:7
This actually works quite well but the clip I've shown is only a small snippet. There are actually 12 lines of this that repeat and it is quite cumbersome. I'm curious if anyone can suggest a more elegant solution
=IF(
SUM(
IF(N6=AB40,(SUMIFS(S7:AD7,$S$6:$AD$6,X41))),
IF(N8=AB40,(SUMIFS(S9:AD9,$S$8:$AD$8,X41))),
IF(N10=AB40,(SUMIFS(S11:AD11,$S$10:$AD$10,X41))),
IF(N12=AB40,(SUMIFS(S13:AD13,$S$12:$AD$12,X41))))=0,"",
SUM(
IF(N6=AB40,(SUMIFS(S7:AD7,$S$6:$AD$6,X41))),
IF(N8=AB40,(SUMIFS(S9:AD9,$S$8:$AD$8,X41))),
IF(N10=AB40,(SUMIFS(S11:AD11,$S$10:$AD$10,X41))),
IF(N12=AB40,(SUMIFS(S13:AD13,$S$12:$AD$12,X41)))))
For the first line, the formula first evaluates if N6=AB40. If this is true, then it looks at the range S6:AD6 and compares it to the value in X41. If the value anywhere in this range is equal to X41 then it sums the corresponding numerical cell below it in range S7:AD:7
This actually works quite well but the clip I've shown is only a small snippet. There are actually 12 lines of this that repeat and it is quite cumbersome. I'm curious if anyone can suggest a more elegant solution