alphabet1111
New Member
- Joined
- Aug 12, 2021
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi! This is my first time on MrExcel, and I'm also new to VBA. I have a rather specific task I need to accomplish in Excel:
- I am working with two tables
- A large dataset (~160k lines) with various descriptive columns, as well as the obligated spend in various years (2016-2020)
- One of the descriptive columns is the code column, called "CODE"
- A table that maps each CODE to a certain market segment - we'll call that column "SEGMENT"
- Some of the CODE values map to multiple SEGMENTs
- If a CODE maps to multiple segments, each segment has an associate % comprising the CODE (for example - Code1 might map to Segment1-40% and Segment2-60%)
- A large dataset (~160k lines) with various descriptive columns, as well as the obligated spend in various years (2016-2020)
- I would like to map each line in the dataset to a particular SEGMENT by creating a new segment column in the dataset with the assigned segment. If one of the data rows has a CODE that maps to multiple SEGMENTs, what I would like to do is:
- Duplicate the data row N times for the N segments that the code maps to
- Multiply ONLY the spend lines by the percentage associated with each segment, and label each of the new lines with the corresponding segment
- (If the CODE maps to just one segment, just simply assign the existing line to the segment)