Sum if columns match in separate sheets and total from another column

2k05gt

Board Regular
Joined
Sep 1, 2006
Messages
157
I have been hurting my brain on this..
I have 3 sheets, 1 sheet "VARs" is a List of the items specs by Model Number, the column I need to sum is in this case weight in Lbs
Sheet 2 "Drive_List" is a List of items that have the same model number (S/N make the different) that are put into Boxes that are numbered
Sheet 3 is "Box Count" this is a count of how many items are in a box and how much it weights . Here is the issue.
How can I get a sum of all the items weight in each box. the weight of each item (model number) is different and each box has a mix of the items.

I tried using indexing, with offset but working with 3 different sheets got confusing, I defined names for each of the columns I was working with
but nothing would work.

Thanks in advance for any assistance :)
 

Attachments

  • picture of sheet.JPG
    picture of sheet.JPG
    96.8 KB · Views: 10

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Some notional data:
Book1
ABC
1ModelWeight (lb)
2a2
3b1.75
4c1.5
5d1
6e1.25
7f0.75
VARS


Book1
ABC
1Box #Model
21a
31a
41b
52a
62a
72b
82c
92c
103b
113b
123c
134a
144c
Drive_List


Then for the summary:
Book1
ABCDE
1Box# DrivesTotal WeightItems in Box
2135.75a, a, b
3258.75a, a, b, c, c
4335b, b, c
5423.5a, c
BOX COUNT
Cell Formulas
RangeFormula
C2:C5C2=COUNTIF(Drive_List!$B$2:$B$14,B2)
D2:D5D2=SUM(XLOOKUP(FILTER(Drive_List!$C$2:$C$14,Drive_List!$B$2:$B$14=B2),VARS!$B$2:$B$7,VARS!$C$2:$C$7))
E2:E5E2=TEXTJOIN(", ",,FILTER(Drive_List!$C$2:$C$14,Drive_List!$B$2:$B$14=B2))
 
Upvote 0
Thanks for the Reply, I do not have XLookup, TextJoin or Filter Functions I am using 2016 I think
 
Upvote 0
I would have sworn I saw 365 in your profile:rolleyes:
Without the 365 functions, the job is a little more difficult, and you will benefit from using some helper columns to tabulate the models found in each box. See the green-shaded section to the right. Pull those formulas out to the right until you see blanks, which means you've covered all items in that box. If you do this once for the maximum number of drives expected to ever be found in a box, then you shouldn't have to do it again.
Book1
ABCDEFGHIJKLMNOP
1Box# DrivesTotal WeightHelper Area
2135.75aab     
3258.75aabcc   
4335bbc     
5423.5ac      
BOX COUNT
Cell Formulas
RangeFormula
C2:C5C2=COUNTIF(Drive_List!$B$2:$B$14,B2)
D2:D5D2=SUM(SUMIF(VARS!$B$2:$B$7,$H2:INDEX(H2:ZZ2,,C2),VARS!$C$2:$C$7))
H2:O5H2=IF(COLUMNS($D:D)<=$C2,INDEX(Drive_List!$C:$C,AGGREGATE(15,6,ROW(Drive_List!$B$2:$B$14)/(Drive_List!$B$2:$B$14=$B2),COLUMNS($D:D))),"")

If you want to simplify the SUMIF formula, you could replace the dynamically formed range $H2:INDEX(H2:ZZ2,,C2) with the maximum range of your helper cells...for example H2:O2...so the formula would be:
Excel Formula:
=SUM(SUMIF(VARS!$B$2:$B$7,H2:O2,VARS!$C$2:$C$7))
 
Upvote 0
Solution
Not sure what's it not picking up, but the weight shows Zero
 

Attachments

  • Box List.JPG
    Box List.JPG
    136.2 KB · Views: 5
  • Drive List.JPG
    Drive List.JPG
    173.3 KB · Views: 5
  • VARs.JPG
    VARs.JPG
    154.1 KB · Views: 4
Upvote 0
Would you show the formula being used in the cell that is producing 0?
 
Upvote 0
Have a look again at how that dynamically formed range is constructed in the SUMIF function. I believe you want:
Excel Formula:
$H3:INDEX(H3:ZZ3,,C3)
...you have an extra :$AK3: in the expression.
 
Upvote 0
Have a look again at how that dynamically formed range is constructed in the SUMIF function. I believe you want:
Excel Formula:
$H3:INDEX(H3:ZZ3,,C3)
...you have an extra :$AK3: in the expression.
Still shows as 0 but when viewed in formula results it looks correct
 

Attachments

  • Screenshot 2024-02-02 110611.jpg
    Screenshot 2024-02-02 110611.jpg
    162.1 KB · Views: 5
Upvote 0
Ok...good. You can see the array in your diagnostics. Click on the cell with the formula, then go into the formula bar where the formula appears (click at the end of the formula), and re-confirm the entry by entering it with Ctrl-Shift-Enter, to enter the formula as an array formula. You should see curly brackets form around the expression. Alternatively, replace this dynamically formed array with a simple range reference to the helper cells in that row.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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