Sum top items between two sheets

joeltes

New Member
Joined
Mar 16, 2018
Messages
21
Hi all,

I have two sheets that contain products and the amount sold, I'm trying to sum the total items sold for only 5 items that sold most. Trick is I want to split the 5 items to sum between two sheets, on sheet1 sum only 2 of 5 (value in D1)

ABCD
1# Rows Count2
2PA15
3PB45
4PC7
5PD12
6PE2
7PM6
8PN18

<tbody>
</tbody>

then check sheet2 and sum the rest of 5 (in this case 3)

AB
1PF21
2PG5
3PH9
4PI16
5PJ8
6PK33
7PL2

<tbody>
</tbody>

In this example the results would be, the top 5 items sold a total of 133. note that only sheet1 specifies the amount of rows to sum.
 
But 18 and 12 are the largest on sheet 1 where there's a 1 in column c, 33,16,9 are the largest on sheet 2 next to a 1 also?
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Alternative formula without having to use Ctrl+Shift+Enter:

Code:
=SUMPRODUCT(LARGE(($B$2:$B$8)*($C$2:$C$8),ROW(INDIRECT("1:"&$D$1))))+SUMPRODUCT(LARGE((Sheet2!$B$1:$B$7)*(Sheet2!$C$1:$C$7),ROW(INDIRECT("1:"&5-$D$1))))

WBD
 
Upvote 0
Alternative formula without having to use Ctrl+Shift+Enter:

Code:
=SUMPRODUCT(LARGE(($B$2:$B$8)*($C$2:$C$8),ROW(INDIRECT("1:"&$D$1))))+SUMPRODUCT(LARGE((Sheet2!$B$1:$B$7)*(Sheet2!$C$1:$C$7),ROW(INDIRECT("1:"&5-$D$1))))

WBD

When applying it as follows, x C:C throws an error, any clues on why?
=SUMPRODUCT(LARGE(PTRN!$M:$M,ROW(INDIRECT("1:"&PTRN!$X$2))))+SUMPRODUCT(LARGE(($O:$O)*($C:$C),ROW(INDIRECT("1:"&50-PTRN!$X$2))))
 
Upvote 0
Don't use the whole column, thats over a million rows in Excel 2007 or later. Even the 65k in earlier versions is outrageous. Does x mean you're using an x instead of 0/1 or you wrote as an example?
 
Upvote 0

Excel 2010
ABCDE
1# Rows Count2
2PA150
3PB45088
4PC71
5PD121
6PE20
7PM60
8PN181
Sheet1
Cell Formulas
RangeFormula
E3=SUMPRODUCT(LARGE(($B$2:$B$8)*($C$2:$C$8),ROW(INDIRECT("1:"&$D$1))))+SUMPRODUCT(LARGE((Sheet2!$B$1:$B$7)*(Sheet2!$C$1:$C$7),ROW(INDIRECT("1:"&5-$D$1))))



Excel 2010
ABC
1PF210
2PG50
3PH91
4PI161
5PJ80
6PK331
7PL21
Sheet2


works in my test, but it's not an exact copy of your data
 
Upvote 0
Excel 2010


Worksheet Formulas
CellFormula
E3=SUMPRODUCT(LARGE(($B$2:$B$8)*($C$2:$C$8),ROW(INDIRECT("1:"&$D$1))))+SUMPRODUCT(LARGE((Sheet2!$B$1:$B$7)*(Sheet2!$C$1:$C$7),ROW(INDIRECT("1:"&5-$D$1))))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

This worked perfectly once I specified the range rather than looking at the whole column. Thanks much!
 
Upvote 0

Forum statistics

Threads
1,215,377
Messages
6,124,597
Members
449,174
Latest member
chandan4057

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top