Share via

Sumproduct across multiple sheets with multiple criteria

Anonymous
2023-10-16T05:18:54+00:00

I'm trying to sum an array on multiple tabs using a combination of indirect and sumproduct.

My formula is:

=SUMPRODUCT( INDIRECT("'"&Tab_List&"'!"&"Z9:EC1000") , (INDIRECT("'"&Tab_List&"'!Z8:EC8")=AK$8) * (INDIRECT("'"&Tab_List&"'!B9:B1000")=$B9) )

Where:

  • Tab_List = a named range with all sheets to be included
  • Z8:EC8 = headings in each of the target tabs with dates
  • AK$8 = the date criteria
  • B9:B1000 = a column of unique identifiers
  • $B9 = the unique identifier criteria

I have 11 tabs I need to sum where the date headings do not all align, and where I only want to sum the values for the unique identifier on that row - so I need to have both the horizontal and vertical criteria.

If anyone can give some tips on getting this to work that would be great, thanks.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2023-10-20T05:58:04+00:00

    https://b23.tv/cACAt4l

    How about this consolidate to one Sheet then sum?

    select * from consolidateSheet limit 20;
    
    cli_one_dim_c~consolidateSheet~3~8;
    
    //select * from consolidateSheetUnion;
    
    create temp table aa as 
    
    select f03,属性,sum(数量) v from consolidateSheetUnion group by f03,属性 order by instr('1-Jan,1-Feb,1-Mar,1-Apr,1-May,1-Jun,1-Jul',属性);
    
    //select * from aa;
    
    cli_create_two_dim_no_order~aa~属性~v;
    
    select * from aa_two_dim;
    
    f01 f02 f03 f04 f05 f06 f07 f08 f09 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f20 f21 f22 f23 f24 f25
    multiple.xlsx Sheet2 1-Mar 1-Apr 1-May 1-Jun 1-Jul - - - - - - - - - - - - - - - - -
    multiple.xlsx Sheet2 a 3 1 - - - - - - - - - - - - - - - - - - - -
    multiple.xlsx Sheet2 d 1 0 1 - - - - - - - - - - - - - - - - - -
    multiple.xlsx Sheet2 e - - - - - - - - - - - - - - - - - - - - - -
    multiple.xlsx Sheet2 f 0 1 1 - - - - - - - - - - - - - - - - -
    multiple.xlsx Sheet1 1-Jan 1-Feb 1-Mar 1-Apr 1-May - - - - - - - - - - - - - - - - -
    multiple.xlsx Sheet1 a 0 1 - - - - - - - - - - - - - - - - - - - -
    multiple.xlsx Sheet1 b 1 0 1 - - - - - - - - - - - - - - - - - -
    multiple.xlsx Sheet1 c - - - - - - - - - - - - - - - - - - - - - -
    multiple.xlsx Sheet1 d 0 1 1 - - - - - - - - - - - - - - - - -
    f03 1-Jan 1-Feb 1-Mar 1-Apr 1-May 1-Jun 1-Jul
    a 1 3.0 1.0 0.0 0.0 0.0
    b 1 1 0.0
    c 0.0 0.0 0.0 0.0 0.0
    d 2 1 1 0.0
    e 0.0 0.0 0.0 0.0 0.0
    f 1 1
    0 comments No comments
  2. Ashish Mathur 101.8K Reputation points Volunteer Moderator
    2023-10-17T00:32:54+00:00

    Hi,

    That formula will get very complicated. It will be far easier to do this in the Query Editor. Share the download link of the file with the 11 tabs. and on the Summary tab, show the expected result in a few lines.

    0 comments No comments
  3. Anonymous
    2023-10-16T21:40:08+00:00

    Hi Peiyezhu, thanks for the reply.

    Here is a simplified version of what I'm trying to do:

    Sheet 1

    Sheet 2

    Consolidated (conditionally summed) data

    So:

    • Each of the individual tabs have dates in the column headings, but they each start and finish at different points.
    • Each tab also has a column of unique identifiers, with some crossover but it's not the same subset in each tab.
    • The consolidation tab has ALL dates from all the unique tabs, and ALL unique identifiers, and I need to get a total for each unique identifiers in each of the date columns.

    I managed to get this formula to work:

    =SUMPRODUCT(SUMIFS(INDIRECT("'"&Tab_List&"'!"&"Z"&ROW($A21)&":EP"&ROW($A21)),INDIRECT("'"&Tab_List&"'!"&"Z8:EP8"),'All Packages'!BL$8))

    But this only sums a row conditional on the column date headings matching, and doesn't take into account the unique identifiers. So in the example above, consolidated tab in row 6 would total 1 for May, as it's only looking at the row number, not the unique identifiers.

    The 11 tabs are necessary. This is a file that will be used ongoing for monthly a monthly process. But we also need to be able to see the combined data by month & unique identifiers in the consolidated tab.

    0 comments No comments
  4. Anonymous
    2023-10-16T06:22:10+00:00

    need to sum where the date headings do not all align?

    If you share your workbooks and expected result,it will be clearer to understand your question.

    By the way,

    have 11 tabs

    How about consoldate to one sheet and then sum?

    0 comments No comments