Create Unique set of data based on Top to bottom level product Codes

aravindhan_31

Well-known Member
Joined
Apr 11, 2006
Messages
672
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi,
below is the data that i have on excel.
Here is the existing process: ( all dummy data)
In a website we have to upload the discount % for a product(unique product code) in a particulate state and city, same product might be there in different cities.
there is Hirarchy created for all products. Product Code 1, 2, 3, 4 & 5 ( Product code 1 - Essentials
under that Product code 2, could be Fruits
under than product code 3 could be Apples/Papaya/melon etc >
under that Product code 4 could be Green Apple/Red Apples, etc>
Under that Product level 5 could be Size)

when we launch discounts, we could decide a % at a product code 1 level or 2 or 3 or 4 or 5. Example If we decide 5% discount for UK, London at product code level 1, then the same% is applied for all products comes under this product code 1, in this case for all essentials its 5% will be applied on the tool irrespective of what ever products comes under level code 1

But, If have to give 5% for all essentials and 10% discount for only for Apples, then I have create 2 rows to upload one with UK, London product code 1 & % column ( so that 5% is applied to all essentials)
and UK, London & product code 4 with 10% . I have 10000 rows of data with all code numbers and % at the last column & this is repetative tasks.

can someone help me with the VBA code that can create unique rows with 4 columns
State, City, Product Code, %



Book1
ABCDEFGH
1StateCityProduct Level 1 CodeProduct Level 2 CodeProduct Level 3 CodeProduct Level 4 CodeProduct Level 5 CodeDisc Count %
2TNPondi616464126167847464746961616784290.00%
3TNPondi616464126168267268144781600012729.38%
4TNChennai616464126168267268144781600012765.00%
5KarnatakaMysore6164641261682672681447816000127827.10%
6KarnatakaMysore6164641261682672681447816000127927.10%
7KarnatakaBangalore6164641261682672681447816000127945.00%
8TNMadurai61646412618867046166929861669299622771670.00%
9KarnatakaMysore6164641261886704626860646649914136.84%
10KarnatakaMysore616464126188670462686066681446816268620636.84%
11TNPondi616464126188670462686066684012440.00%
12KarnatakaBangalore6164641261886704626860666840124440.00%
13TNPondi61646412681447746166626068144164681441914.22%
14TNChennai61646412681447746222611262997786629977892.64%
15TNChennai61646412681447746768611867694844600027642.64%
16TNPondi61646412681447746768611867694844600027644.22%
17TNPondi61646412681447746768611867694844600027644.22%
18KarnatakaMysore616464126814477467686118676948446000276440.00%
19TNPondi616464126814477467686118676948444.22%
Sheet1
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi all,

Figure out a way on the application to do this, hence no macros required.

Thanks for everyone who looked at this :)

Regards
Arvind
 
Upvote 0

Forum statistics

Threads
1,223,796
Messages
6,174,657
Members
452,575
Latest member
Fstick546

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