+ Reply to Thread
Results 1 to 9 of 9

Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions?

  1. #1
    Registered User
    Join Date
    10-10-2019
    Location
    Monroe, LA
    MS-Off Ver
    Microsoft Excel for Office 365 MSO (16.0.11328.20418) 32-bit
    Posts
    5

    Question Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions?

    Hi, I am looking for a more efficient way to calculate the customer ranking highlighted yellow in the "Analysis" tab attached.

    My source data is included in the adjacent tab labeled "Data."

    The data source contains a list of locations by row (col A), a proximity rank (col B) according to how close the location is to company HQ (note some location rankings are ties), and the remaining columns include customer name and customer spend at each location (note customers can spend at multiple locations).

    I have created a weighted average proximity rank per dollar spent in the "Analysis" tab. Right now, I am running into two problems when using this approach for a larger data set:

    1. Is there a formulaic solution for creating the unique list of customer names (col A) in the "Analysis" tab? Right now, I am manually copying and removing duplicates.
    2. I am aggregating the spend amounts via SUMIFS formulas, but my 32-bit excel runs out of memory when I expand this to a larger data set. In reality, I have thousands of locations and thousands of customers to analyze.

    Thanks in advance for any ideas for more efficient solutions.

    BB
    Attached Files Attached Files

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions

    In A and down for uniques: =INDEX(Data!$A2:$A100, MATCH(0, COUNTIF($A$2:A2,Data!A2:A100), 0)) - CSE formula(use Ctrl+Shift+Enter)
    in B3 down and right: =SUMPRODUCT((Data!$A$2:$A$13=$A3)*(Data!$B$2:$B$13=B$2)*(Data!$H$2:$L$13)) don't use sumproduct for entire columns(A:D) use it on ranges(A2:D1000)
    Click the * to say thanks.

  3. #3
    Registered User
    Join Date
    10-10-2019
    Location
    Monroe, LA
    MS-Off Ver
    Microsoft Excel for Office 365 MSO (16.0.11328.20418) 32-bit
    Posts
    5

    Re: Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions

    Quote Originally Posted by PaulM100 View Post
    In A and down for uniques: =INDEX(Data!$A2:$A100, MATCH(0, COUNTIF($A$2:A2,Data!A2:A100), 0)) - CSE formula(use Ctrl+Shift+Enter)
    in B3 down and right: =SUMPRODUCT((Data!$A$2:$A$13=$A3)*(Data!$B$2:$B$13=B$2)*(Data!$H$2:$L$13)) don't use sumproduct for entire columns(A:D) use it on ranges(A2:D1000)
    I appreciate the help, but this solution pulls the location into column A. I need to pull the unique list of customers (from C2:G13 in the "Data" tab) into the col A of the "Analysis" tab.

    To be clear, I need the resulting data to appear exactly as it does in my example in the "Analysis" tab. I just need a more efficient and scalable solution. Thanks.

  4. #4
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions

    Got it. Then try these formulas:
    For unique Customer, array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Wrap it in a IFERROR if you wanna get rid of errors.
    For total amounts:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-10-2019
    Location
    Monroe, LA
    MS-Off Ver
    Microsoft Excel for Office 365 MSO (16.0.11328.20418) 32-bit
    Posts
    5

    Re: Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions

    Quote Originally Posted by PaulM100 View Post
    Got it. Then try these formulas:
    For unique Customer, array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Wrap it in a IFERROR if you wanna get rid of errors.
    For total amounts:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The unique customer formula works in the example sheet. However, when I apply it to the larger data set I get a circular reference error. It says the references that caused the error cannot be listed. My formula is below (identical to yours except the data set is larger):

    =INDEX(Sheet2!$C$2:$AA$2191, MIN(IF(COUNTIF($A$2:A2, Sheet2!$C$2:$AA$2191)=0, ROW(Sheet2!$C$2:$AA$2191)-MIN(ROW(Sheet2!$C$2:$AA$2191))+1)), MATCH(0, COUNTIF($A$2:A2, INDEX(Sheet2!$C$2:$AA$2191, MIN(IF(COUNTIF($A$2:A2, Sheet2!$C$2:$AA$2191)=0, ROW(Sheet2!$C$2:$AA$2191)-MIN(ROW(Sheet2!$C$2:$AA$2191))+1)), , 1)), 0), 1)

  6. #6
    Registered User
    Join Date
    10-10-2019
    Location
    Monroe, LA
    MS-Off Ver
    Microsoft Excel for Office 365 MSO (16.0.11328.20418) 32-bit
    Posts
    5

    Re: Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions

    Quote Originally Posted by BayouBoy View Post
    The unique customer formula works in the example sheet. However, when I apply it to the larger data set I get a circular reference error. It says the references that caused the error cannot be listed. My formula is below (identical to yours except the data set is larger):

    =INDEX(Sheet2!$C$2:$AA$2191, MIN(IF(COUNTIF($A$2:A2, Sheet2!$C$2:$AA$2191)=0, ROW(Sheet2!$C$2:$AA$2191)-MIN(ROW(Sheet2!$C$2:$AA$2191))+1)), MATCH(0, COUNTIF($A$2:A2, INDEX(Sheet2!$C$2:$AA$2191, MIN(IF(COUNTIF($A$2:A2, Sheet2!$C$2:$AA$2191)=0, ROW(Sheet2!$C$2:$AA$2191)-MIN(ROW(Sheet2!$C$2:$AA$2191))+1)), , 1)), 0), 1)
    Apologies. The error was on my side.

    Any tips for copying that uniques formula all the way down to the bottom? I double-clicked the bottom right corner of the first cell with the formula in the example file, but my larger data set won't let me do that. Manually dragging it down is the only thing I've found to work so far.

  7. #7
    Registered User
    Join Date
    10-10-2019
    Location
    Monroe, LA
    MS-Off Ver
    Microsoft Excel for Office 365 MSO (16.0.11328.20418) 32-bit
    Posts
    5

    Re: Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions

    The SUMPRODUCT solution is taking a long time to process. I may need to restructure my data in some way and aggregate it differently. The SUMPRODUCT formulas have been processing for 34 minutes and have only processed 100 rows of data (I need to process over 4,000 rows across 2,000 columns).

    Is there another way to approach this?

  8. #8
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions

    I'm try to write in VBA

    It's take 16 min. for 50 rows (@1000 customer / @1000 spent)



    Regards.
    Attached Files Attached Files

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Summing Data Across Multiple Columns with Multiple Criteria - More Efficient Solutions

    Please try Power Query

    Open Power Query/Get and Transform. Click on New Query.

    Open blank query in the editor, launch Advanced Editor and paste in the following code.

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. summing data based on criteria on multiple rows and columns
    By Andy N in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-09-2017, 03:07 PM
  2. [SOLVED] Summing data across multiple criteria on multiple worksheets
    By PDBartlett in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-01-2015, 11:57 AM
  3. Summing multiple criteria across rows and columns
    By kimberly01 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-01-2013, 12:52 AM
  4. multiple criteria between two values, multiple solutions
    By excelnuguy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2011, 05:46 PM
  5. Summing from 2 criteria and multiple repeated columns
    By Bassteban in forum Excel General
    Replies: 7
    Last Post: 08-17-2011, 02:37 PM
  6. Issue with summing columns with multiple criteria
    By dcshaker in forum Excel General
    Replies: 4
    Last Post: 06-12-2011, 06:55 AM
  7. Summing multiple columns based on criteria
    By bigduke6 in forum Excel General
    Replies: 2
    Last Post: 04-06-2011, 10:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1