Macro to Map data columns in two sheets and produce data in third sheet

promax

New Member
Joined
Apr 12, 2015
Messages
9
Hi There

Would be grateful if someone can help develop a macro to solve below problem

* Sheet 1 is base datafile mapping our master product file with master product file received from our suppliers / merchants
* Sheet 2 is daily price list that we receive from the supplier in that format
* Sheet 3 is the format in which we need output basis mapping of sheet 1 with sheet 2. Instructions are given against each field. We use sheet 3 to upload the file in our system that calculates final selling price to retail consumers

the file formats are attached on google drive link here: https://drive.google.com/folderview?id=0B7ynWqzeAP-VRU9DdXNTTmV3dE0&usp=sharing

Many thanks for your time and help here.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
45738lipton g tea light 100 ba306065liptonabc45738lipton g tea light 100 ba20020050
17732l'oreal total repair serum 80m306180lorealxyz17732l'oreal total repair serum 80m1501250
sheet 3
30606545738liptonabc50
30618017732lorealxyz1250
is this what you want in your sheet 3

<colgroup><col><col><col><col span="5"><col><col span="4"></colgroup><tbody>
</tbody>
 
Upvote 0
Many thanks for prompt response.

This is what I want in sheet 3 - two parts - Part I and Part II

Part I - information on all items found in Sheet 2:
SKU ID Product Name MRP Special Price Quantity
306065 Lipton ABC 200 NA 50
306180 lorealxyz 125 100 0

Part II: List down all items from Sheet 1, where pricing information could not be locate in the Sheet 2 - Price Information Sent by the Supplier. Format: Product code of the supplier [P-Code] and [Supplier Product Name]

Note: Special Price - which typically indicates a discounted price - will be NA if Sheet 2 has Special Price and MRP as equal - example if both MRP and Special Price is 200 in Sheet 2 then Sheet 3 will show Special Price as NA or will show it as blank. If Special Price is smaller then MRP in Sheet 2, then Sheet 3 will populate both MRP and Special Price. MRP means Maximum Retail Price.



promax
 
Upvote 0
sheet1sheet 2
45738lipton g tea light 100 ba306065liptonabc45738lipton g tea light 100 ba20020050
17732l'oreal total repair serum 80m306180lorealxyz17732l'oreal total repair serum 80m1501250
sheet 3
30606545738liptonabc50
30618017732lorealxyz1250
is this what you want in your sheet 3
headings missed off so i confused you - tell me what you want in terms of sheets1,2 and 3 as I made them

<colgroup><col><col><col><col span="5"><col><col span="4"></colgroup><tbody>
</tbody>
 
Upvote 0
I have made edits under sheet 3 as also added headers for both sheet 1 and sheet 2. Hope this should make things clearer.
sheet1sheet 2
Supplier Product CodeSupplier Product NamePromax Product CodePromax Product NameSupplier Product CodeSupplier Product NameList PriceSelling PriceQuantity
45738lipton g tea light 100 ba306065liptonabc45738lipton g tea light 100 ba20020050
17732l'oreal total repair serum 80m306180lorealxyz17732l'oreal total repair serum 80m1501250
Sheet 3 -Part IShould populate following information.
Promax Product CodeSupplier Product Code Not RequiredPromax Product NameProduct List PriceProduct Discount Price - keep blank if List Price and Selling Price is Same in Sheet 2, else Populate Selling Price from Sheet 2Product Quantity
30606545738liptonabc20050
30618017732lorealxyz1501250
Part II of Sheet 3 or you can say Sheet 4 - OK either waysTo list Down Supplier Product Code and Supplier Product Name of All Items for which no information was available in Sheet 2 [i.e. it gives items where supplier did not send any price information to promax]
is this what you want in your sheet 3See above on what I want in Sheet three I hope that is useful. I had also attached google drive link in my very first post - if that proves useful.

<tbody>
</tbody>
 
Upvote 0
COL Asheet1COL Hsheet 2
suppcodesuppprodnamepromaxcodepromaxnameROW 2suppcodesuppprodnamelistpricesellingpricequantity
45738lipton g tea light 100 ba306065liptonabc45738lipton g tea light 100 ba20020050
17732l'oreal total repair serum 80m306180lorealxyz17732l'oreal total repair serum 80m1501250
12345acme t paste 100444123acme toothpaste 100 gm12345acme t paste 100756540
23456smith r bl 5444124smith razor blades 5 pack34567jones b beans 4003535200
34567jones b beans 400444125jones baked beans 400 gm56789heinz veg s4444100
45678heinz tom s444126heinz tomato soup
56789heinz veg s444127heinz vegetable soup
sheet 3COL E
ROW 17promaxcodepromaxnamelistpricedisc pricequantity
306065liptonabc20050
306180lorealxyz1501250
444123acme toothpaste 100 gm756540
444124smith razor blades 5 packNO DETAILS AVAILABLE
444125jones baked beans 400 gm35200
444126heinz tomato soupNO DETAILS AVAILABLE
444127heinz vegetable soup44100
D18
=OFFSET($D$2,ROW()-17,0)
E18
=IF(ISERROR(OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),2)),"NO DETAILS AVAILABLE",OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),2))
F18
=IF(IF(ISERROR(OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),2)),"NO DETAILS AVAILABLE",OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),3))=E18,"",(IF(ISERROR(OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),2)),"NO DETAILS AVAILABLE",OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),3))))
G18
=IF(E18="NO DETAILS AVAILABLE","",IF(IF(ISERROR(OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),2)),"NO DETAILS AVAILABLE",OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),4))=F18,"",(IF(ISERROR(OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),2)),"NO DETAILS AVAILABLE",OFFSET($H$2,MATCH(OFFSET($C$2,MATCH($C18,$C$3:$C$9,0),-2),$H$3:$H$9,0),4)))))
listpriceNO DETAILS AVAILABLE
Count of promaxcode
promaxcodeTotal
4441241a simple pivot table based on sheet3 pulls out products where no details available
4441261
Grand Total2

<colgroup><col><col><col><col><col><col span="3"><col><col><col><col span="33"></colgroup><tbody>
</tbody>
 
Upvote 0
Dear Oldbrewer,

Thanks for your help and prompt response, however I have not understood this.
Note that sheet 1 sheet 2 and sheet 3 are only names I was using. Actually both sheet 1 and sheet 2 are separate individual excel files in which data is available to us [eg. file name 'sheet 1.xls' is prepared one time but 'sheet 2.xls' which is supplier price data is sent to us say every alternate day] and basis this, 'sheet 3.xls' as output is required in the 3rd file. So where do I copy the given formulae? You have mention Row 17 - but the results can start from row 2 itself in sheet 3.xls assuming row 1 is for the header titles.

I am sorry I did not follow through the solution and hence I am asking.

Also, we need a Maco based solution where all mapping and output happens at click of a button, since we have multiple suppliers and everyday about 25% of the suppliers will send us new supplier price information.
 
Upvote 0
the row and column locations are to help you understand how the formulas work.

I have used "tables" on the same sheet to demonstrate the approach. Easy to refer to say [supplierpricedata]sheet1!A1 in the formulas

or - in an out of the way place on your "sheet3" you could have a block of cells eg in CA1 = [supplierpricedata]sheet1!A1 then you can use my formulas without the need for external references.

no problem with supplier info coming every 2 days - just over-write the previous 1

multiple suppliers - make sure they use a common format and then put supplier1 info in first 200 rows, supplier2 info in rows 201 to 400 etc

that way you can update as they come in and the whole sheet of ALL your supplier info in effect becomes a giant lookup table
 
Upvote 0
the row and column locations are to help you understand how the formulas work.

I have used "tables" on the same sheet to demonstrate the approach. Easy to refer to say [supplierpricedata]sheet1!A1 in the formulas - Promax: where do I use [supplierpricedata]sheet1!A1 in the above example Please let me know what to find and replace

or - in an out of the way place on your "sheet3" you could have a block of cells eg in CA1 = [supplierpricedata]sheet1!A1 then you can use my formulas without the need for external references. Promax - Did not understand this

no problem with supplier info coming every 2 days - just over-write the previous 1

multiple suppliers - make sure they use a common format and then put supplier1 info in first 200 rows, supplier2 info in rows 201 to 400 etc Promax - this solution does not work. Each supplier sends files separately and there is no uniform time for them to send. The three sheets are worked out separately, the third sheet or the third output file is also used to independently update another system. Hence the output is needed in independent supplier wise files [to note: even input files are maintained or is made available supplier wise only.]

that way you can update as they come in and the whole sheet of ALL your supplier info in effect becomes a giant lookup table

See my inline comments above
 
Upvote 0
if you have info in another sheet you have to use eg =sheet2!A1

but if you put the info way over to the right on your existing sheet you can refer to direct eg =DA1

if say block 401 to 600 is for supplier 3 whenever supplier 3 sends an update delete 401 to 600 then paste in new data

my first point I was merely saying I put info on same sheet for ease of understanding logic, but if you need it on say sheet2 you will reference it by eg sheet2!A1
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,161
Members
448,948
Latest member
spamiki

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