Difficult but not impossible

decent_boy

Board Regular
Joined
Dec 5, 2014
Messages
130
Office Version
  1. 2016
Platform
  1. Windows
Hello, hope that you are well

I need a macro for my result sheet , let me explain you that i have sheet1 and there are 3 fields from col a to c and i need a macro for result sheet which matches ID number from result sheet col a (where DI# is blank in col b) with sheet1 col a and copy/distribute b col value from sheet1 to result sheet in col c which must be equal d col value , ok please see below example in red highlighted font cells as a macro result.

Sheet1
IDEDI #Qty
A11A12452
A11A13451
A11A154510
A16B45673
A16B678930

<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>

Result Sheet
IDDI#EDI #Qty
A11-A12452
A11-A13451
A11-A15451
A122345 1
A133245 1
A16-B45673
A16-B67892
A16-B67891

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 
Ignore what I did have written here as that wouldn't make any sense with the next ID's
 
Last edited:
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Rick what you need to know more please ask I will explain but I give short example here suppose in sheet 1 in col a there are different and same name fruits and in column b their unique serial number and in column c fruits quantity
You are told to distribute these fruits in result sheet as per conditions.

1- Match fruit name with sheet

2- Where is DI # number is blank in result sheet

3-Give fruit (means copy EID #) from sheet 1 to result sheet as per given quantity of result sheet
once matching fruit quantity is ended in sheet 1 then go to next matching fruit name and copy data from their
 
Upvote 0
Rick what you need to know more please ask I will explain but I give short example here suppose in sheet 1 in col a there are different and same name fruits and in column b their unique serial number and in column c fruits quantity
You are told to distribute these fruits in result sheet as per conditions.

1- Match fruit name with sheet

2- Where is DI # number is blank in result sheet

3-Give fruit (means copy EID #) from sheet 1 to result sheet as per given quantity of result sheet
once matching fruit quantity is ended in sheet 1 then go to next matching fruit name and copy data from their
I still do not understand how the 10 and the 30 became 1 and either 2 or 1 depending on what the mistake in the repeat of B6789 actually was.
 
Upvote 0
I still do not understand how the 10 and the 30 became 1 and either 2 or 1 depending on what the mistake in the repeat of B6789 actually was.

First I would like to tell you B6789 is a typo mistake which i have removed in below data and second thing is we are not copying/distributing Qty from sheet1 to result sheet but we have to only copy EDI # from sheet1 to result sheet by matching their ID and remaining conditions as mentioned above post.

Sheet1
IDEDI #Qty
A11A12452
A11A13451
A11A154510
A16B45673
A16B678930

<tbody>
</tbody>


Result Sheet
IDDI#EDI #Qty
A11-A12452
A11-A13451
A11-A15451
A1223451
A1332451
A16-B45673
A16-B67892

<tbody>
</tbody>

 
Upvote 0
more explanation there are total 13 qty against ID A11 having different EDI # in sheet1 but result is demanding 4 qty against ID A11 so we distribute data like below

IDDI#EDI #Qty
A11-A12452
A11-A13451
A11-A15451

<tbody>
</tbody>
 
Upvote 0
more explanation there are total 13 qty against ID A11 having different EDI # in sheet1 but result is demanding 4 qty against ID A11 so we distribute data like below

IDDI#EDI #Qty
A11-A12452
A11-A13451
A11-A15451

<tbody>
</tbody>

I think I see what you want now. Question... would it ever be possible for the quantity to be more than a single EDI# has available as shown in Sheet1? By that, I mean could the table look like this and, if so, how would the EDI#'s fill in?


IDDI#EDI #Qty
A11-4
A11-3
A11-2

<tbody>
</tbody>
 
Upvote 0
Rick sheet1 has always more quantity than result sheet and qty in result is always equal or less than sheet1 qty
 
Upvote 0
Rick sheet1 has always more quantity than result sheet and qty in result is always equal or less than sheet1 qty

My one more quest is that is that possible that macro check qty count of result sheet and if demanding qty is greater in starting count and it goes down and check another matching qty if it is equal or greater like in above you case i solve it like that


Result Sheet
IDDI#EDI #Qty
A11-A15454
A11-A15453
A11-A15452
A11A12452

<colgroup><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0
My one more quest is that is that possible that macro check qty count of result sheet and if demanding qty is greater in starting count and it goes down and check another matching qty if it is equal or greater like in above you case i solve it like that


Result Sheet
IDDI#EDI #Qty
A11-A15454
A11-A15453
A11-A15452
A11A12452

<tbody>
</tbody>


Can anybody please solve it
 
Upvote 0

Forum statistics

Threads
1,216,037
Messages
6,128,440
Members
449,453
Latest member
jayeshw

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