Search code examples
excel-formulamatchsumifs

Lookup headers and selectively sum cells below it


I am trying to find a specific column based on month (B1) and sum the cells under it. Furthermore, im trying to only sum the cells in that column by the designated region (D1). This is what I figured it would be but excel doesn't see it as a valid function.

=SUMIFS(ADDRESS(MATCH(A3,A:A,0)+10,MATCH(B1,3:3,0)):ADDRESS(MATCH(A3,A:A,0)+1,MATCH(B1,3:3,0)),A4:A$12,D1)

enter image description here


Solution

  • =SUMIFS(INDEX($1:$1048576,0,MATCH(B1,3:3,0)),A:A,D1)
    

    The INDEX($1:$1048576,0,MATCH(B1,3:3,0)) returns the whole column where Row 3 equals B1. Then sums that column where column A equals D1.

    If you want to limit it to only Rows 4:12 like your current formula:

    =SUMIFS(INDEX($4:$12,0,MATCH(B1,3:3,0)),$A$4:$A$12,D1)