Function to show which value belongs to which

mergim

New Member
Joined
Nov 24, 2020
Messages
49
Office Version
  1. 365
Platform
  1. Windows
Hello all,

I am trying to make a function that shows by which quantity the "sold" quantity is supplied by. For example, the first 3 sold quantities, -50, -30 and -20 are all supplied by the first 100 (received), as the 100 can cover all those.
It will not be able to cover the next -20, as we then would be in deficit. The last -20 will then be supplied by the next "received quantity" which is 20.

Is there a way of setting up a system or a function?


Let me know if something is unclear.

Thanks a lot!

1683535771700.png
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
How do you envisage the results being displayed?

After showing the expected output for the above, can you also show that again if the first 3 lots sold were 50, 30 and 25?
 
Upvote 0
How do you envisage the results being displayed?

After showing the expected output for the above, can you also show that again if the first 3 lots sold were 50, 30 and 25?
Hi,

The purpose of this is to show which date or when we expect to have enough material to supply the demand/sold units.
It could be nice if I had some sort of unique number that shows the link, so fx 50,30 and 20 is supplied by the first 100 - they could have the number 1.

If we go with 50, 30, 25 then only the first two 50, 30 can be supplied, the next 25 would have to take from the next quantity available.
 
Upvote 0
As I asked before:

Could you show us what the results should look like?
Hello Peter,

Here is a more thorough explanation. I hope it helps! The Column "Link" is something I would like to have done automatically :)

I am trying to find a link between which purchase order will supply which work order demand. For example, the first work order, 43081340 will be supplied by the first purchase order 59747( )(1)(1) as 100.000 can cover 25.459.
The same goes for the next work order, 43081341, again, here the first purchase order 59747( )(1)(1) will also be able to supply this amount as 25.459 + 23.189 are still not higher than 100.000. When the third work order comes, 43081094, here we have multiple purchase orders that would have to supply in order to cover the demand. Here we would need PO 59747 1-2, 1-3, and 1-4. Right now, I am doing this manually, so I hope you guys can help me with some sort of function or ideas. Please, feel free to ask for more info if needed.

*work order demand = is the material consumption


SORT DATEITEM NUMBERITEM DESCRIPTIONTYPEORDER NUMBERQTYDateAcumulatedLink
100001123456ApplesPurchase order59747( )(1)(1)100.00027-06-2023100.0001
100002123456ApplesPurchase order59747( )(1)(2)100.00027-06-2023200.0002
100003123456ApplesPurchase order59747( )(1)(3)100.00011-07-2023300.0002
100004123456ApplesPurchase order59747( )(1)(4)100.00011-07-2023400.0002
100005123456ApplesPurchase order59747( )(1)(5)100.00025-07-2023500.0003
100006123456ApplesPurchase order59747( )(1)(6)100.00025-07-2023600.0003
100007123456ApplesWork order demand43081340- 25.45929-07-2023574.5411
100008123456ApplesWork order demand43081341- 23.18912-08-2023551.3521
100009123456ApplesWork order demand43081094- 258.23822-08-2023293.1142
100010123456ApplesWork order demand43081342- 23.13826-08-2023269.9762
100011123456ApplesPurchase order59747( )(1)(7)100.00005-09-2023369.9764
100012123456ApplesPurchase order59747( )(1)(8)100.00005-09-2023469.9765
100013123456ApplesWork order demand43081343- 28.90809-09-2023441.0682
100014123456ApplesWork order demand43081098- 234.58418-09-2023206.4843
100015123456ApplesPurchase order59747( )(1)(10)100.00019-09-2023306.4845
100016123456ApplesPurchase order59747( )(1)(9)100.00019-09-2023406.4846
100017123456ApplesWork order demand43081344- 29.07023-09-2023377.4144
100018123456ApplesPurchase order59747( )(1)(11)100.00003-10-2023477.4146
100019123456ApplesPurchase order59747( )(1)(12)100.00003-10-2023577.4146
100020123456ApplesWork order demand43081345- 29.85106-10-2023547.5644
100021123456ApplesWork order demand43081105- 234.02410-10-2023313.5396
100022123456ApplesWork order demand43081121- 294.21903-11-202319.3206
100023123456ApplesPurchase order59747( )(1)(14)100.00007-11-2023119.3207
100024123456ApplesPurchase order59747( )(1)(13)100.00007-11-2023219.3207
100025123456ApplesPurchase order59747( )(1)(15)100.00014-11-2023319.3207
100026123456ApplesWork order demand43081127- 296.00328-11-202323.3177
100027123456ApplesPurchase order59747( )(1)(16)100.00005-12-2023123.3178
100028123456ApplesPurchase order59747( )(1)(17)100.00019-12-2023223.3178
100029123456ApplesPurchase order59747( )(1)(18)100.00019-12-2023323.3178
100030123456ApplesWork order demand43081135- 304.10826-12-202319.2098
 
Upvote 0
With your further explanation, I understand how the two green values below are arrived at but after that I am struggling and I think that is because I don't understand how you came up with the yellow values. From what I can see those rows appear to be six separate order numbers, so why do, for example, three of them get the same value (2) in the Link column?

mergim.xlsm
DEFGHI
1TYPEORDER NUMBERQTYDateAcumulatedLink
2Purchase order59747( )(1)(1)10027/06/20231001
3Purchase order59747( )(1)(2)10027/06/20232002
4Purchase order59747( )(1)(3)10011/07/20233002
5Purchase order59747( )(1)(4)10011/07/20234002
6Purchase order59747( )(1)(5)10025/07/20235003
7Purchase order59747( )(1)(6)10025/07/20236003
8Work order demand43081340-25.45929/07/2023574.5411
9Work order demand43081341-23.18912/08/2023551.3521
10Work order demand43081094-258.23822/08/2023293.1142
11Work order demand43081342-23.13826/08/2023269.9762
Sheet1
 
Upvote 0
With your further explanation, I understand how the two green values below are arrived at but after that I am struggling and I think that is because I don't understand how you came up with the yellow values. From what I can see those rows appear to be six separate order numbers, so why do, for example, three of them get the same value (2) in the Link column?

mergim.xlsm
DEFGHI
1TYPEORDER NUMBERQTYDateAcumulatedLink
2Purchase order59747( )(1)(1)10027/06/20231001
3Purchase order59747( )(1)(2)10027/06/20232002
4Purchase order59747( )(1)(3)10011/07/20233002
5Purchase order59747( )(1)(4)10011/07/20234002
6Purchase order59747( )(1)(5)10025/07/20235003
7Purchase order59747( )(1)(6)10025/07/20236003
8Work order demand43081340-25.45929/07/2023574.5411
9Work order demand43081341-23.18912/08/2023551.3521
10Work order demand43081094-258.23822/08/2023293.1142
11Work order demand43081342-23.13826/08/2023269.9762
Sheet1
Hello,

So in order to cover the quantity from work order 43081094 (258,238), you would need the quantity from PO 59747 1-2, 1-3 and 1-4 otherwise we would not have enough. I see in your table it says 100, but it should be 100000 like in my table. I hope it makes sense.
 
Upvote 0
I see in your table it says 100, but it should be 100000 like in my table.
Ah, you must use "." as your thousands separator. For me "." is the decimal separator so Excel has converted to my notation. Perhaps for the future sample data you could try XL2BB

I hope it makes sense.
Not really. I'm struggling to understand the full logic of how you have come up (manually) with the numbers in the link column. At this stage I certainly cannot see a formula to produce those numbers.
 
Upvote 0
Ah, you must use "." as your thousands separator. For me "." is the decimal separator so Excel has converted to my notation. Perhaps for the future sample data you could try XL2BB


Not really. I'm struggling to understand the full logic of how you have come up (manually) with the numbers in the link column. At this stage I certainly cannot see a formula to produce those numbers.
Hello I simply just calculate by adding and substracting the numbers.
Maybe you should ask the questions, which POs will cover this amount (work order), e.g. with work order 43081094, 258238 kg, in order to cover the quantity, what POs do you need?

This is very complex
 
Upvote 0
Ah, you must use "." as your thousands separator. For me "." is the decimal separator so Excel has converted to my notation. Perhaps for the future sample data you could try XL2BB


Not really. I'm struggling to understand the full logic of how you have come up (manually) with the numbers in the link column. At this stage I certainly cannot see a formula to produce those numbers.
Hello Peter,

I may have found another way to explain the issue, please see table below (I have added a picture as well).
Imagine that we have a demand of 25000 like the first row of the table under column "Demand", and the first PO is 100000. As first PO (100000) is higher than first demand (25000) then it should say covered as you see under column Coverage. I have simply used the formula If(sum(B2+B3)>=sum(A2+A3);"Covered";"Not Covered").
Where it gets tricky is when I do the same task for the next demand. Here I look at, can the first PO of 100000 cover first demand (25000) and second demand (100000) - here, the answer is no, because 125000 is more than 100000. So, to cover both demand first and second demand, you need first PO 100000 and second PO (50000).
The function should be something like, if PO cannot cover this amount, use second PO. If it still doesnt cover, use also PO 3 etc.

I hope it makes sense!

DemandPurchase OrderCoverage
25000​
100000​
Covered
100000​
50000​
50000​
30000​
40000​
10000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​
20000​

1684235764128.png
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,218
Members
453,024
Latest member
Wingit77

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