Append Value from 3 worksheet to the Right of a New Worksheet

airforceone

Board Regular
Joined
Feb 14, 2022
Messages
201
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Need help again mate.... hopefully my last hurdle to finishing my project (hope someone notice)

can anyone nudge me to the correct path :)
anyway what I'm trying to achieve is append records from 3 sheets into a new one (see sample table).
Copy product sheet to a new sheet then test for Buyer with 2 conditions (Control Number and Product Description) if condition is met then append buyer record to the last column corresponding control number and product description same with seller


UPLOAD.xlsx
ABC
1CONTROL NUMBERDATEPROD DESC
2A00012017.02.16Apple - Green
3A00012017.02.16Apple - Red
4A00012017.02.16Apple - Black
5A00022017.10.13Mango
6A00032019.10.30Buko
7A00042014.02.05Blueberries
8A00052014.02.05Avocado
9A00062013.06.19Papaya
10A00072011.04.01Lychee
11A00082011.05.30Pineapple
12A00092022.04.28Durian
13A00102022.05.24Orange - Small
14A00102022.05.24Orange - Large
15A00102022.05.24Orange - Medium
PRODUCT


UPLOAD.xlsx
ABCD
1CONTROL NUMBERDATE COMMITTEDPROD DESCSELLER LAST NAME
2A00012017.02.16Apple - GreenNOVEMBER
3A00022017.10.13MangoLIMA
4A00032019.10.30BukoPAPA
5A00042014.02.05BlueberriesROMEO
6A00052014.02.05AvocadoCHARLIE
7A00062013.06.19PapayaTWITTER
8A00072011.04.01LycheeGAMA
9A00082011.05.30PineappleAMAZON
10A00092022.04.28DurianDOE
11A00102022.05.24Orange - SmallPETER
12A00102022.05.24Orange - LargeCOM
13A00102022.05.24Orange - MediumCAMI
SELLER


UPLOAD.xlsx
ABCD
1CONTROL NUMBERDATE COMMITTEDPROD DESCBUYER LAST NAME
2A00012017.02.16Apple - GreenEBAY
3A00012017.02.16Apple - RedZETA
4A00012017.02.16Apple - BlackMIKE
5A00022017.10.13MangoECHO
6A00032019.10.30BukoHERNANDEZ
7A00042014.02.05BlueberriesROMEO
8A00052014.02.05AvocadoNOVEMBER
9A00062013.06.19PapayaROMEO
10A00072011.04.01LycheeEBAY
11A00082011.05.30PineappleBRABO
12A00092022.04.28DurianLIMA
13A00102022.05.24Orange - SmallPAPA
14A00102022.05.24Orange - LargeCHARLIE
15A00102022.05.24Orange - MediumPero
BUYER


UPLOAD.xlsx
ABCDE
1CONTROL NUMBERDATEPROD DESCSELLER LAST NAMEBUYER LAST NAME
2A00012017.02.16Apple - GreenNOVEMBEREBAY
3A00012017.02.16Apple - RedNOVEMBERZETA
4A00012017.02.16Apple - BlackNOVEMBERMIKE
5A00022017.10.13MangoLIMAECHO
6A00032019.10.30BukoPAPAHERNANDEZ
7A00042014.02.05BlueberriesROMEOROMEO
8A00052014.02.05AvocadoCHARLIENOVEMBER
9A00062013.06.19PapayaTWITTERROMEO
10A00072011.04.01LycheeGAMAEBAY
11A00082011.05.30PineappleAMAZONBRABO
12A00092022.04.28DurianDOELIMA
13A00102022.05.24Orange - SmallPETERPAPA
14A00102022.05.24Orange - LargeCOMCHARLIE
15A00102022.05.24Orange - MediumCAMIPero
OUTPUT
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Thanks for that. OK, I ran the code on your shared file, and it ran perfectly. Link to the file (with code added) below:
2023.10.09 - Mr.Excel Code checked.xlsm
sorry mate code does not work I don't know what went wrong is it my file or what, but sharing my SS now...
2023-10-09 13_54_54-Greenshot.jpg
 

Attachments

  • 2023-10-09 13_57_44-Greenshot.jpg
    2023-10-09 13_57_44-Greenshot.jpg
    167.3 KB · Views: 11
Upvote 0
Thanks for letting me know. Looks like you've got a solution anyway, so this will remain a mystery (y)
 
Upvote 0
your code works great! but hurts my brain so painfully :)
is there a way to scale the code a bit? i still have a few columns/fields that should be included in the output....
Nice to heat it works.
My VBA code will iterate through each row in the PRODUCT sheet, creating a dictionary with a key formed by concatenating the values of the three columns A|B|C, for example:

Key: A0001|2017.10.13|Mango

and

Item: "|" (a "|" with left (for SELLER) and right (for BUYER) is blank initial)

Then, it will iterate through each row in the SELLER/BUYER sheet, find the corresponding key in the dictionary, and then put the SELLER on the left and the BUYER on the right. For example:

SELLER sheet: row 2, (key: A0001|2017.10.13|Mango) will take the item and add it to the left: "LIMA|"
BUYER sheet, row 4, (key: A0001|2017.10.13|Mango), will take the item and add it to the right, becoming: "LIMA|ECHO"

So, the dictionary will include:
...
...
... Key: A0001|2017.10.13|Mango, and Item: "LIMA|ECHO"
...

Then, iterate through each key, split it into corresponding cells to get the final result.

Hope it clear for you.
 
Upvote 0
Nice to heat it works.
My VBA code will iterate through each row in the PRODUCT sheet, creating a dictionary with a key formed by concatenating the values of the three columns A|B|C, for example:

Key: A0001|2017.10.13|Mango

and

Item: "|" (a "|" with left (for SELLER) and right (for BUYER) is blank initial)

Then, it will iterate through each row in the SELLER/BUYER sheet, find the corresponding key in the dictionary, and then put the SELLER on the left and the BUYER on the right. For example:

SELLER sheet: row 2, (key: A0001|2017.10.13|Mango) will take the item and add it to the left: "LIMA|"
BUYER sheet, row 4, (key: A0001|2017.10.13|Mango), will take the item and add it to the right, becoming: "LIMA|ECHO"

So, the dictionary will include:
...
...
... Key: A0001|2017.10.13|Mango, and Item: "LIMA|ECHO"
...

Then, iterate through each key, split it into corresponding cells to get the final result.

Hope it clear for you.
thanks mate, will try to study it later cheers...
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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