Data categorizing macro

dzhogov

New Member
Joined
Apr 1, 2019
Messages
11
Hello all,

I am very new to VBA and apologize in advance for the 'simple' question. I am working with thousands of rows of data in a pivot table data sheet where there are 8 categories as shown:

MonthProduct IDProduct nameSales RepProduct CategoryProduct BrandQuantityValue

<tbody>
</tbody>

The data I extract from my company's software gives me all the categories except Product category and Product Brand. Every product has a unique ID, there are about ~150 products, split into 3 brands, each with different product categories (which sometimes overlap). For example

71500 - chicken wings- bone on category - Chicken Joe brand
75502 - chicken drumsticks- bone on category - Happy Chicken brand
75502 - chicken fillet - boneless category - Happy Chicken brand
76500 - breaded fillet - breaded category - Chicken Deluxe brand

What I need is a macro which, based on the product's code, fills in the Product category and Brand for me. I prefer this over highlighting all the blanks and then pasting the information from the row above with a formula, as I believe a macro would be fairly easy to create and automating this process is worth it.

I am guessing that going about this with a giant IF statement which checks each product code and assigns it a Category and Brand is not the best option, so I am open to any suggestions. Maybe some sort of validation sheet? Being as specific as possible would be of great help since, like I mentioned, I am new to VBA.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
in the first two rows what is the logic that says one is chicken joe and one is happy chicken ?
 
Upvote 0
One company, 3 brands, occasionally overlapping product names. The idea is that the only realiable way to identify a product and assign it to a category & brand is its ID, rather than its name.
 
Upvote 0
so each new product you introduce, assign a brand and a unique id. Then in your first table where you have product id, use that to get category and brand...........
 
Upvote 0

Forum statistics

Threads
1,214,994
Messages
6,122,633
Members
449,092
Latest member
bsb1122

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