Based on the Location & Quantity, Locations to be grouped & corresponding sum to be added

vasu2007

New Member
Joined
Nov 16, 2014
Messages
9
Office Version
  1. 2019
Platform
  1. Windows
Hello Friends,

I need to summarize data based on the locations & Quantity.
Truck will go to different locations & loads the Quantity.
Requirement will better understood by looking at the picture.
Explanation is given in the comments column.

Sorry guys, I have searched lot of forums but unable find the solution.
As I am a beginner in vba, I know, I cant do this as it is a complicated logic involved.
Seeking your help.

Thanks in advance.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
would a pivot table help, as that would Group items and sum

Perhaps use the XL2BB add-in - see signature
OR load a sample sheet - no private data - onto a share like dropbox or onedrive
 
Upvote 0
Trial work-vba.xlsm
ABCDEFGHIJKL
1My Data:Desired Output
2SL NOLocationQuantityTruck TypeNo.of TrucksPer Truck (helper column)SL NOStorage LocationQTYNO. OF TRUCKSComments
31A116 MT117.61A+B+C1If Truck is 1 in E column, It goes to location A+B+C & Qty is 17.6
41C0.82A1If Truck is 2 in E column, 1 truck will go to location A and loads 24.9 Qty(Total Qty/2)
51A4.72A+B+C+D12nd Truck will goes to location A & takes remaining 6.5 qty & goes to another locations(B+C+D) for remaining qty
61B113A1if truck is 3 in E col, It goes to location A & takes Qty 21.9
717.63B+C1B+C sum is coming around 21 tons, so truck 2 goes to B+C location
82D1.321 MT224.93A+D13rd Truck goes to Location A+D for taking remaining Qty.
92D4.5
102C4.8
112A31.4balance Qty: 31.4-24.9=6.5
122B4.9
132B1.3
142B1.7
1549.8
163C4.521 MT321.97
173C0.7
183B15.9
193D3.7
203D2.2
213D5.8
223D5
233D3
243D1
253A24.1Bal 2.133
2665.9
Trucks (2)
Cell Formulas
RangeFormula
F3F3=C7/E3
F8F8=C15/E8
F16F16=C26/E16
 
Upvote 0
Trial work-vba.xlsm
ABCDEFGHIJKL
1My Data:Desired Output
2SL NOLocationQuantityTruck TypeNo.of TrucksPer Truck (helper column)SL NOStorage LocationQTYNO. OF TRUCKSComments
31A116 MT117.61A+B+C17.61If Truck is 1 in E column, It goes to location A+B+C & Qty is 17.6
41C0.82A24.91If Truck is 2 in E column, 1 truck will go to location A and loads 24.9 Qty(Total Qty/2)
51A4.72A+B+C+D25.012nd Truck will goes to location A & takes remaining 6.5 qty & goes to another locations(B+C+D) for remaining qty
61B113A21.91if truck is 3 in E col, It goes to location A & takes Qty 21.9
717.63B+C21.11B+C sum is coming around 21 tons, so truck 2 goes to B+C location
82D1.321 MT224.93A+D22.813rd Truck goes to Location A+D for taking remaining Qty.
92D4.5
102C4.8
112A31.4balance Qty: 31.4-24.9=6.5
122B4.9
132B1.3
142B1.7
1549.8
163C4.521 MT321.97
173C0.7
183B15.9
193D3.7
203D2.2
213D5.8
223D5
233D3
243D1
253A24.1Bal 2.133
2665.9
Trucks
Cell Formulas
RangeFormula
F3F3=C7/E3
F8F8=C15/E8
F16F16=C26/E16
 
Upvote 0
Trial work-vba.xlsm
ABCDEFGHIJKL
1My Data:Desired Output
2SL NOLocationQuantityTruck TypeNo.of TrucksPer Truck (helper column)SL NOStorage LocationQTYNO. OF TRUCKSComments
31A116 MT117.61A+B+C1If Truck is 1 in E column, It goes to location A+B+C & Qty is 17.6
41C0.82A1If Truck is 2 in E column, 1 truck will go to location A and loads 24.9 Qty(Total Qty/2)
51A4.72A+B+C+D12nd Truck will goes to location A & takes remaining 6.5 qty & goes to another locations(B+C+D) for remaining qty
61B113A1if truck is 3 in E col, It goes to location A & takes Qty 21.9
717.63B+C1B+C sum is coming around 21 tons, so truck 2 goes to B+C location
82D1.321 MT224.93A+D13rd Truck goes to Location A+D for taking remaining Qty.
92D4.5
102C4.8
112A31.4balance Qty: 31.4-24.9=6.5
122B4.9
132B1.3
142B1.7
1549.8
163C4.521 MT321.97
173C0.7
183B15.9
193D3.7
203D2.2
213D5.8
223D5
233D3
243D1
253A24.1Bal 2.133
2665.9
Trucks (2)
Cell Formulas
RangeFormula
F3F3=C7/E3
F8F8=C15/E8
F16F16=C26/E16
Pls ignore this image. Qty column has no values
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

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