How to Consolidate large Qty of unique numbers w/ matching criteria into fewer numbers


New Member
May 24, 2016
Good morning all,

I am reaching out to the community for some assistance or guidance in regards to a fairly lengthy, involved document that I am working on. I have used this forum countless times and have found it to be a great source.

I am self taught and this is my first post, so please be kind! I hope that I have detailed my predicament satisfactorily.

I know that there is a quicker, more efficient method than what I am doing.

Here is a breakdown of the of the task and attached is an example of the spreadsheet involved. This is related to retail and SKU #’s or “Stock Numbers”. I will refer to said stock numbers as “Style ID” as that is how they are represented on the spread sheet

After an amount of time it becomes necessary for my company (we are a very large company) to do some house cleaning in regards to the number of SKU’s that exist within our system. All goods that we sell have an eight (8) digit code (can include zero’s) associated with them that we refer to as a “Style ID”. Each Style ID falls under a “Sub Class” which falls under a “Class” that is under the Department.

Here is an example of the structure:
Dept. ID
Class ID: 08
Sub Class ID: 8001
Style ID: 00000367

Within the Style ID there are a number of other Key “parameters” or “conditions” such as size range, pack quantities, and price.

Style ID: 00000367
Size Range ID: 000
Inner Pack Qty: 2
Perm Retail Price: 2.49

Here is an example scenario:

Lets say that I have one hundred (100) styles that are all within Department: 01 Class: 80 and Sub Class: 8001.
Each style has a set of varying parameters (Size, Pack Qty, Price) within as stated above. My goal is to “merge” or “consolidate” these into as few numbers as possible. The key is that the parameters of the “From” Style and “To” Style MUST match. There may be cases where a number has no match and therefore is standalone. In other cases there may be any given amount, it could be ten (10) to one-hundred plus (100+) styles that could possibly be consolidated into a single Style ID.

Attached is what I have so far. I cant add a document so I included an image link. The first list is the Raw Data (Blue). The second list is where I am at presently (Green) and you can see that I have indeed identified the “From” and “To” numbers, but how I there seems far too involved and overly complicated.

Imgur: The most awesome images on the Internet

What I do is take the original list and throw it into Power Query. I then Sort in this order:

1.) Department ID
2.) Class ID
3.) Subclass ID
4.) Size Range ID
5.) Inner Pack ID
6.) Perm Retail Price

I then add add 3, 4, 5, and 6 parameters together and multiply by the inner pack (I do not include the Style ID) to create a unique number for my identifier (I know there has to be a better way). I then do a countif to find my first instance, which I designate as the “To” style. I then have more IF’s so that each style that falls below the To style on my list is added under “To” style in a neighboring column. So, in the end I may be able to push something like three-thousand (3000) Style ID’s into two-hundred fifty (250) or one hundred thirty-five (it varies) Style ID’s. it basically ends up looking something like this:

To me this seems far too involved an convoluted. We usually do this quarterly and it is very time consuming, so you can see why any help I can get simplifying this process would be amazing. In the end I would love to create a working copy and paste template with just a couple macros if necessary.

I have an example document if needed.

Thank you in advance!!!

Some videos you may like

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Watch MrExcel Video

Forum statistics

Latest member

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
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 "".
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