Index match help with division

proficient

Well-known Member
Joined
Apr 10, 2012
Messages
745
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Hello all,

I have shared two tables below, first one is a DATA SOURCE and second one is the DESIRED RESULT. I want the DESIRED RESULT in yellow highlighted columns in the 2nd table.

I am looking for a particular formula which can read and match the product ID from DATA SOURCE and distribute the quantity in their respective column's cell, furthermore the quantity distributed by the formula shall not exceed from the CUT QUANTITY of that particular product ID.

Book1.xlsx
BCDFGHIJKL
1DATA SOURCE
2PRODUCT IDCUSTOMEROCS SHIPMENT DATECUT QTY (3% EXTRA)TOTAL CUTBALANCETOTAL OUTPUTBALANCETOTAL SENT TO WASHSENT TO WASH BALANCE
35064H & M5-Jul30903090002950-1402500-450
45066H & M5-Jul41203500-6202796-7041022-1774
55027-2H & M5-Jul51504250-9003795-4551881-1914
6
7DESIRED RESULT
8PRODUCT IDCUSTOMEROCS SHIPMENT DATECUT QTY (3% EXTRA)TOTAL CUTBALANCETOTAL OUTPUTBALANCETOTAL SENT TO WASHSENT TO WASH BALANCE
95066H & M5-Jul18541854001854001022-832
105064H & M5-Jul1545154500154500154500
115027-2H & M5-Jul32963296003296001881-1415
125066H & M6-Jul1236123600942-29400-942
135064H & M6-Jul1030103000103000955-75
145066H & M7-Jul1030410-62000-4100000
155064H & M7-Jul51551500375-14000-375
165027-2H & M7-Jul1854954-900499-45500-499
Sheet2
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Any clues as to the logic that you use to determine how the distribution should be calculated? Without a clear explanation this is likely to remain unanswered.
 
Upvote 0
Any clues as to the logic that you use to determine how the distribution should be calculated? Without a clear explanation this is likely to remain unanswered.
Thank you Jasonb75 for your reply.

I want proportional distribution based on criteria (Product ID) and cut qty 3% extra in DESIRED RESULT table. If in DATA SOURCE product ID TOTAL CUT is 3,500 units, then formula will distibute these 3,500 units in DESIRED RESULT table against product ID # 5066 like I mentioned 1854, 1030 and 410.
 
Upvote 0
That still tells us nothing, there appears to be no logical consistency with the rate of distribution.
 
Upvote 0
Hello Jasonb75,

let me rephrase all the scenario for you.

I am picking only 1 Product ID to make you understand what I am actually looking for.

Let's say the ID is 5066

As you can see in DATA SOURCE table total 3500 units have been cut in TOTAL CUT column.

I want to distribute these 3500 units in DESIRED RESULT table in 5066 IDs (as you can see there are three IDs of 5066) in FIFO method (first in first out).

The formula I am looking for will match the Product ID and distribute 1854 units in first 5066 ID as CUT QTY. with 3% of first ID of 5066 is 1854 units in DESIRED RESULT table.

Now there are 1646 units left, it will now distribute 1236 units in second ID of 5066 (as you can see CUT QTY. with 3% of second ID of 5066 is 1236 units).

Now only 410 units left but the CUT QTY. WITH 3% of third ID of 5066 is 1030, in this case it can distribute only 410 units. rest of the 620 units will be added in them once they are produced.

KEY NOTE: Quantity should not be exceeded of any product ID from its CUT QTY. WITH 3% while distributing the units.


If you need more clarity, please ask.
 
Upvote 0
Ok, that is making more sense, but where is the fifo information coming from? There is nothing in the source to identify it.

If the 'Desired result' table will already contain some information then we need to know what is already there and what needs to be completed by the formulas.
 
Upvote 0
Ok, that is making more sense, but where is the fifo information coming from? There is nothing in the source to identify it.

If the 'Desired result' table will already contain some information then we need to know what is already there and what needs to be completed by the formulas.
There are similarities in both sheets (Product ID to cut qty. with 3%) that are content. And I have put them manually. Rest of the columns are formula based. (From cut qty. with 3% to total sent to wash).
 
Upvote 0
Some of the misunderstanding was an error on my part. While it wasn't entirely clear what you needed, I had missed that you said in post 1 that you only needed formulas for the yellow cells.

See if this does what you need, it works with the examples provided.
Book1
BCDEFGHIJKL
7DESIRED RESULT
8PRODUCT IDCUSTOMEROCS SHIPMENT DATECUT QTY (3% EXTRA)TOTAL CUTBALANCETOTAL OUTPUTBALANCETOTAL SENT TO WASHSENT TO WASH BALANCE
95066H & M443821800185418540185401022-832
105064H & M4438215001545154501545015450
115027-2H & M443823200329632960329601881-1415
125066H & M443831200123612360942-2940-942
135064H & M44383100010301030010300955-75
145066H & M4438410001030410-6200-41000
155064H & M443845005155150375-1400-375
165027-2H & M4438418001854954-900499-4550-499
Sheet1
Cell Formulas
RangeFormula
F9:F16F9=E9*1.03
G9:G16G9=MEDIAN(0,F9,VLOOKUP(B9,$B$3:$G$5,6,0)-SUMIF(B$8:B8,B9,F$8:F8))
H9:H16H9=G9-F9
I9:I16I9=MEDIAN(0,G9,VLOOKUP(B9,$B$3:$I$5,8,0)-SUMIF(B$8:B8,B9,I$8:I8))
J9:J16,L9:L16J9=I9-G9
K9:K16K9=MEDIAN(0,G9,VLOOKUP(B9,$B$3:$K$5,10,0)-SUMIF(B$8:B8,B9,K$8:K8))
 
Upvote 0
Jason, the formula is working perfectly! Thank you so much :-)

Can you elaborate how MEDIAN manages this whole thing? TIA
 
Upvote 0
How did you think that MEDIAN can fullfil the requirement, I have checked every step in the formula by pressing F9 function key, there are three numbers Median is dealing with. It os just amazing. Do let me know how did you think to use this formula.

Many thanks Jason ?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
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