lookup and distribute the qty based on capacity

ExcelNewbie2020

Active Member
Joined
Dec 3, 2020
Messages
333
Office Version
  1. 365
Platform
  1. Windows
i have monthly sales table (jan to mar).. i need a formula to place it into the summary table..
however, need to consider the capacity.. like for example sold qty for apple in the month of jan is 120 but the first truck capacity is only 100. the remaining qty (20) will be distributed to the next truck..

see table (blue is the expected result)


Excel.xlsm
ABCDEFGHIJKL
1formula heresold
2fruitstruckcapacityjanfebmarjanqty
3apple1001100100apple120
4apple100212020100grapes80
5apple100380orange110
6grapes10041008020
7grapes1005803020feb
8orange1006100100apple100
9orange100712010100grapes50
10orange100890
11
12mar
13grapes20
14orange100
15
16
Sheet12
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Try this... notice every fruit starts at row 11, 21, 31, etc... it is much easier to work with a relative reference. second, the formulas use a relative reference at row 10, row 10 being the quantity sold. here are the formulas, and an image of the result. Please scroll down. Also, if you want to pretty this up more, you can add another sheet3, and use sheet3 to reference only the items you want to show. cheers.

''cell A1janqtyfebqtymarqty
=ROW()apple120apple100apple0
=ROW()grapes80grapes50grapes20
=ROW()orange110orange0orange100
=ROW()
=ROW()
=ROW()
=ROW()JanFebMar
=ROW()soldsoldsold
=ROW()fruitstruckcapacityinto truck=D2capacityinto truck=F2capacityinto truck=H2
=ROW()apple1001100=IF(D11-F10<0,D11,F10)=F10-E11100=IF(H11-J10<0,H11,J10)=J10-I11100=IF(L11-N10<0,L11,N10)=N10-M11
=ROW()apple1002120=IF(D12-F11<0,D12,F11)=F11-E12120=IF(H12-J11<0,H12,J11)=J11-I12120=IF(L12-N11<0,L12,N11)=N11-M12
=ROW()apple100380=IF(D13-F12<0,D13,F12)=F12-E1380=IF(H13-J12<0,H13,J12)=J12-I1380=IF(L13-N12<0,L13,N12)=N12-M13
=ROW()
=ROW()
=ROW()
=ROW()
=ROW()
=ROW()
=ROW()into truck=D3into truck=F3into truck=H3
=ROW()grapes1004100=IF(D21-F20<0,D21,F20)=F20-E21100=IF(H21-J20<0,H21,J20)=J20-I21100=IF(L21-N20<0,L21,N20)=N20-M21
=ROW()grapes100580=IF(D22-F21<0,D22,F21)=F21-E2280=IF(H22-J21<0,H22,J21)=J21-I2280=IF(L22-N21<0,L22,N21)=N21-M22
=ROW()=IF(D23-F22<0,D23,F22)=F22-E23=IF(H23-J22<0,H23,J22)=J22-I23=IF(L23-N22<0,L23,N22)=N22-M23
=ROW()
=ROW()
=ROW()
=ROW()
=ROW()
=ROW()
=ROW()into truck=D4into truck=F4into truck=H4
=ROW()orange1006100=IF(D31-F30<0,D31,F30)=F30-E31100=IF(H31-J30<0,H31,J30)=J30-I31100=IF(L31-N30<0,L31,N30)=N30-M31
=ROW()orange1007120=IF(D32-F31<0,D32,F31)=F31-E32120=IF(H32-J31<0,H32,J31)=J31-I32120=IF(L32-N31<0,L32,N31)=N31-M32
=ROW()orange100890=IF(D33-F32<0,D33,F32)=F32-E3390=IF(H33-J32<0,H33,J32)=J32-I3390=IF(L33-N32<0,L33,N32)=N32-M33
=ROW()
=ROW()
=ROW()
=ROW()
=ROW()

1711661543765.png
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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