Request for a Macro solution for my complicated task

skavinkumar

New Member
Joined
Oct 12, 2020
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hello Experts,

I Kindly request your support to provide me an solution (Macro / excel formula / tool) for a complicated routine task of mine. because I have do the below example in day to day life like 100s of time.

Description of the requirement

I have 3 lines with negative quantity in "Qty" column. In total (-18) Qty.

The delivery date for these quantities is comment (22-Oct-2020)

I need to fill the delivery date for the additional Qty, which are the positive Qty in "Qty" column, on priority basis based on the "Item Code" column. Priority item codes listed in order in last column of the source table. this Priority list is fixed one.

if in case the qty in a single line exceeds the remaining negative qty available then the line should be duplicated and Qty should be spited accordingly. Please refer lines in green on the "Results I want to Have" Table.

Then on the remark column, I need to have the Remark in the negative qty lines as "Moved to so and so Item code" refer "Result I want to have" Table. And on the delivery dated filled lines I need to have the Remark as "Coming from so and so item code"

Source Table

PositionSub PositionItem codeOEM CODEQtyDelivery DateRemarksOrder of priority
3​
1​
---A123BCDE0DEF1
3​
2​
ABC1A123BCDE9CDE2
3​
3​
BCD1A123BCDE-15FGH1
3​
4​
ABC2A123BCDE32EFG2
3​
5​
CDE2A123BCDE3FGH2
3​
6​
DEF1A123BCDE0BCD2
3​
7​
EFG2A123BCDE5HIJ1
3​
8​
EFG1A123BCDE0GHI1
3​
9​
FGH2A123BCDE6GHI2
3​
10​
FGH1A123BCDE6IJK2
3​
11​
BCD2A123BCDE53GHI3
3​
12​
HIJ1A123BCDE9IJK1
3​
13​
GHI1A123BCDE19BCD1
3​
14​
GHI3A123BCDE-1DEF2
3​
15​
IJK1A123BCDE-3CDE3
3​
16​
GHI2A123BCDE1ABC1
3​
17​
IJK2A123BCDE5EFG1
3​
18​
DEF2A123BCDE12ABC2
3​
19​
CDE3A123BCDE189

Result I Want to Have

PositionSub PositionItem codeOEM CODEQtyDelivery DateRemarks
3​
1​
---A123BCDE0
3​
2​
ABC1A123BCDE9
3​
3​
BCD1A123BCDE-15Moved to CDE2, EFG2, FGH2, FGH1
3​
4​
ABC2A123BCDE32
3​
5​
CDE2A123BCDE322-Oct-20Coming from BCD1
3​
6​
DEF1A123BCDE0
3​
7​
EFG2A123BCDE522-Oct-20Coming from BCD1
3​
8​
EFG1A123BCDE0
3
9
FGH2A123BCDE522-Oct-20Coming from BCD1, GHI1 & IJK1
3
9
FGH2A123BCDE1
3​
10​
FGH1A123BCDE622-Oct-20Coming from BCD1
3​
11​
BCD2A123BCDE53
3​
12​
HIJ1A123BCDE9
3​
13​
GHI1A123BCDE19
3​
14​
GHI3A123BCDE-1Moved to FGH2
3​
15​
IJK1A123BCDE-3Moved to FGH2
3​
16​
GHI2A123BCDE1
3​
17​
IJK2A123BCDE5
3​
18​
DEF2A123BCDE12
3​
19​
CDE3A123BCDE189
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,223,693
Messages
6,173,866
Members
452,536
Latest member
Chiz511

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