Complicated distribution amount into multiple cells in column based on cell with many steps

tubrak

Board Regular
Joined
May 30, 2021
Messages
220
Office Version
  1. 2019
Platform
  1. Windows
Hi
here is my data in sheet
A.xlsm
ABCDEFGIJKLMN
1ITEMDESCRIBEQTYPRICEAMOUNTDESCRIBEAMOUNTDATEDESCRIBEAMOUNTS
21TTTM 1222 50PCS10.0012.00120.0001/01/2024Tire installation200
32TTTM 1223 50PCS7.0016.00112.0001/01/2024Tire patching inside100
43TTTM 1224 100PCS4.0011.0044.0002/01/2024Tire lead200
54TTTM 1225 80PCS5.006.0030.0002/01/2024Tire installation100
65TTTM 1226 100PCS10.0010.00100.0003/01/2024Tire patching120
76TTTM 1227 20 PCS10.0011.00110.0004/01/2024Tire patching inside100
87TTTM 1228 25PCS15.006.0090.0005/01/2024Tire patching outside120
98TTTM 1229 44 PCS25.005.00125.00
109TTTM 1230 35PCS20.0010.00200.00
11TOTAL87.00931.00
INVOICE
Cell Formulas
RangeFormula
E2:E10E2=C2*D2
D11:E11D11=SUM(D2:D10)
Cells with Data Validation
CellAllowCriteria
I2,R1List=$R$1:$R$4

what I want just macro to do this
when select item by data validation in I2 then merge amounts in column N for duplicates items based on column M and show in J2
I will take value 12 in D2 as example how calculate
step 1=(12/87)=0.137931034
step2= 0.137931034*100=13.7931%
step3=13.7931*200/100=27.58621
step 4=27.58621+12=39.59
for more details
in step 1 value 12 is D2 , 87 will be in last cell in column D
step 3 200 will be in I2 ,as to 100 will be %
result will be in column D

A.xlsm
ABCDEFGIJKLMNOP
1ITEMDESCRIBEQTYPRICEAMOUNTDESCRIBEAMOUNTDATEDESCRIBEAMOUNTS
21TTTM 1222 50PCS10.0039.59395.90Tire patching inside20001/01/2024Tire installation200
32TTTM 1223 50PCS7.0052.78369.4601/01/2024Tire patching inside300
43TTTM 1224 100PCS4.0036.29145.1602/01/2024Tire lead200
54TTTM 1225 80PCS5.0019.7998.9502/01/2024Tire installation100
65TTTM 1226 100PCS10.0032.99329.9003/01/2024Tire patching120
76TTTM 1227 20 PCS10.0036.29362.9004/01/2024Tire patching inside100
87TTTM 1228 25PCS15.0019.79296.8505/01/2024Tire patching outside120
98TTTM 1229 44 PCS25.0010.75268.75
109TTTM 1230 35PCS20.0032.99659.80
11TOTAL281.262,927.67
INVOICE
Cell Formulas
RangeFormula
E2:E10E2=C2*D2
D11:E11D11=SUM(D2:D10)
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I can replicate your numbers (except your E9 which looks like an error) as follows:

ABCDEFGHIJKLMN
1ITEMDESCRIBEQTYPRICEAdj. PriceAMOUNTDESCRIBEAMOUNTDATEDESCRIBEAMOUNTS
21TTTM 1222 50PCS101239.59395.90Tire patching inside2001/01/2024Tire installation200
32TTTM 1223 50PCS71652.78369.461/01/2024Tire patching inside100
43TTTM 1224 100PCS41136.29145.162/01/2024Tire lead200
54TTTM 1225 80PCS5619.7998.952/01/2024Tire installation100
65TTTM 1226 100PCS101032.99329.903/01/2024Tire patching120
76TTTM 1227 20 PCS101136.29362.904/01/2024Tire patching inside100
87TTTM 1228 25PCS15619.79296.855/01/2024Tire patching outside120
98TTTM 1229 44 PCS25516.49412.25
109TTTM 1230 35PCS201032.99659.80
11TOTAL873,071.17
Sheet1
Cell Formulas
RangeFormula
J2J2=SUMIFS(N2:N8,M2:M8,I2)
E2:E10E2=ROUND(D2+D2/D$11*J$2,2)
D11,F11D11=SUM(D2:D10)
F2:F10F2=C2*E2

Two comments:

1. I'm not sure why you want a macro to do this. In my view, it's dangerous to have a macro overwriting the prices in column D, as you lose the ability to audit the calculation.

2. It's also not clear why you're spreading the $200 extra cost based on the prices per unit, i.e. ignoring the different quantities. Is the result correct, i.e. the increase in total price from $931.00 to $3,071.17?
 
Upvote 0
Solution
I can replicate your numbers (except your E9 which looks like an error) as follows:
sorry about error!🙏
1. I'm not sure why you want a macro to do this. In my view, it's dangerous to have a macro overwriting the prices in column D, as you lose the ability to audit the calculation.
I realized that after posted my thread and waiting for comments from members what say.;)
It's also not clear why you're spreading the $200 extra cost based on the prices per unit
no this not cost , this is revenue I would show price sales for each item.
the increase in total price from $931.00 to $3,071.17?
will show me sales total
thank you so much for your help.:)
 
Upvote 0
OK, I'm glad it's giving you the results you want (although I have doubts about the validity of the maths).
 
Upvote 0

Forum statistics

Threads
1,225,699
Messages
6,186,523
Members
453,362
Latest member
zermrodrigues

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