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.
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

oldbrewer

Well-known Member
Joined
Apr 11, 2010
Messages
11,004
in the first two rows what is the logic that says one is chicken joe and one is happy chicken ?
 

dzhogov

New Member
Joined
Apr 1, 2019
Messages
11
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.
 

oldbrewer

Well-known Member
Joined
Apr 11, 2010
Messages
11,004
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...........
 

Watch MrExcel Video

Forum statistics

Threads
1,127,653
Messages
5,626,098
Members
416,161
Latest member
David1966Lewis

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
Top