+ Reply to Thread
Results 1 to 15 of 15

Sumproduct with matched column in multiple arrays

  1. #1
    Registered User
    Join Date
    07-02-2012
    Location
    Morgan Hill, CA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Sumproduct with matched column in multiple arrays

    Hi:

    I am trying to build a model that allows for sum of multiplication across two arrays with a column match in both locations. I have the basic formula working well as follows:

    =SUMPRODUCT('Unit Sales by Location'!B3:K3,'Current Cost by Location'!B3:K3)

    However, I need the item information in column A to be matched in BOTH worksheets such that if the order gets changed in either of the source worksheets, the formula will sum the arrays correctly. When I manipulate the formula as such:

    =SUMPRODUCT(--('Unit Sales by Location'!$A$3:$A$18=A3),'Unit Sales by Location'!$B$3:$B$18,'Current Cost by Location'!$B$3:$B$18)

    I am only matching column information.

    I have edited this formula to:

    =SUMPRODUCT(--('Unit Sales by Location'!$A$3:$A$18=A3),'Unit Sales by Location'!$B$3:$K$18,'Current Cost by Location'!$B$3:$K$18)

    and get the dreaded #Value! Any ideas how I can get the desired result?

    I am attaching the work in process. The main take-away is I need to be able to compare columns B and C on the "Current to Bid 1" Worksheet. I prefer a formula solution to vba, if possible.

    Many thanks,

    Kevin

  2. #2
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: Sumproduct with matched column in multiple arrays

    Maybe

    =SUMPRODUCT(('Unit Sales by Location'!$A$3:$A$18=A3)*('Current Cost by Location'!$A$3:$A$18=A3)*'Unit Sales by Location'!$B$3:$K$18*'Current Cost by Location'!$B$3:$K$18)

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Sumproduct with matched column in multiple arrays

    Try this
    IN G3, then dragdown.
    Please Login or Register  to view this content.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Registered User
    Join Date
    07-02-2012
    Location
    Morgan Hill, CA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Sumproduct with matched column in multiple arrays

    Thank you both for your help; I think I am almost there. However, I have noticed that both these formulas only work when both arrays are in the order in column A. If I make one of them ascending and the other decending, the formulas return some weirdness (see attached). Any ideas? I have pasted the data in columns B and C as controls.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Sumproduct with matched column in multiple arrays

    Items in A column of "Unit Sales by Location" will appear only once (as in the example) or sometimes appear in more rows.
    Eg; 123456 apeear in 3 row only.
    Some times it may appear in 3, 7, 9 etc Rows also.

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sumproduct with matched column in multiple arrays

    with a pivot table after rearange the data.

    i used power query for that (to rearange the data).
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Sumproduct with matched column in multiple arrays

    Try this

    =SUMPRODUCT(INDEX('Unit Sales by Location'!$B$3:$K$18,MATCH($A3,'Unit Sales by Location'!$A$3:$A$18,0),)*INDEX('Current Cost by Location'!$B$3:$K$18,MATCH($A3,'Current Cost by Location'!$A$3:$A$18,0),))

  8. #8
    Registered User
    Join Date
    07-02-2012
    Location
    Morgan Hill, CA
    MS-Off Ver
    Excel 2007
    Posts
    6

    SOLVED-Re: Sumproduct with matched column in multiple arrays

    Solved. kvsrinivasamurthy, your Index Match was the key. Thanks so much to all for your help!

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Sumproduct with matched column in multiple arrays

    Welcome. Glad to help.

  10. #10
    Registered User
    Join Date
    07-02-2012
    Location
    Morgan Hill, CA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Sumproduct with matched column in multiple arrays

    Folks, my challenge became a little more challenging. In short, I need to be able to match a column across many rows in two separate worksheets and multiply the variables (adding the results).
    For instance, what is to total current COGS for Loc 1 for all the items in group A? I also have to assume that the order of the items could change. I need to execute this with a formula because the various "bid" worksheets will be changing.

    Your help is greatly appreciated! I have been trying various index matches in sumproduct to no avail for about four hours.

    Best,

    Kevin

  11. #11
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Sumproduct with matched column in multiple arrays

    In G3, then drag across

    =SUMPRODUCT(('Unit Sales by Location'!$B$3:$B$18=$F3)*(INDEX('Unit Sales by Location'!$C$3:$L$18,,MATCH(G$2,'Unit Sales by Location'!$C$2:$L$2,0))*INDEX('Current Cost by Location'!$C$3:$L$18,,MATCH(G$2,'Current Cost by Location'!$C$2:$L$2,0))))

  12. #12
    Registered User
    Join Date
    07-02-2012
    Location
    Morgan Hill, CA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Sumproduct with matched column in multiple arrays

    This is really close. However, when I sort the information in either source data files, we lose the integrity of the formula. I added the filter for "Grade" to the second array but this does not solve the problem. Do the data sources have to be in the same format? I am fearful that these will get messed up along the path.

    Best,

    Kevin

  13. #13
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Sumproduct with matched column in multiple arrays

    Upload the file showing what is the problem.

  14. #14
    Registered User
    Join Date
    07-02-2012
    Location
    Morgan Hill, CA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Sumproduct with matched column in multiple arrays

    Please see attached.

    The first data source is sorted descending, the second is sorted ascending.

  15. #15
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Sumproduct with matched column in multiple arrays

    Helper columns are used: Column F to Column L
    Pl see attached file.
    ARRAY formula in F3, then drag across.

    =SUM((INDEX('Unit Sales by Location'!$C$3:$L$18,MATCH($A3&$B3,'Unit Sales by Location'!$A$3:$A$18&'Unit Sales by Location'!$B$3:$B$18,0),MATCH(F$2,'Unit Sales by Location'!$C$2:$L$2,0))*INDEX('Current Cost by Location'!$C$3:$L$18,MATCH($A3&$B3,'Current Cost by Location'!$A$3:$A$18&'Current Cost by Location'!$B$3:$B$18,0),MATCH(F$2,'Current Cost by Location'!$C$2:$L$2,0))))

    Formula in R3, then drag across.

    =SUMPRODUCT(($B$3:$B$18=$Q3)*(INDEX($F$3:$O$18,,MATCH(R$2,$F$2:$O$2,0))))

+ 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. Color matched cells when using arrays
    By capson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2015, 04:44 PM
  2. [SOLVED] need help getting sumproduct to sort multiple arrays
    By mmccra2858 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-22-2015, 09:38 AM
  3. Replies: 1
    Last Post: 04-20-2013, 03:31 AM
  4. Sumproduct for multiple arrays, ignoring zeros
    By snoproladd in forum Excel General
    Replies: 2
    Last Post: 02-21-2012, 04:46 PM
  5. Replies: 0
    Last Post: 08-29-2011, 04:04 PM
  6. SUMPRODUCT two text are matched in the list
    By shahidkhaki in forum Excel General
    Replies: 4
    Last Post: 08-05-2007, 05:08 PM

Tags for this Thread

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