MacroTestQ
New Member
- Joined
- Jun 30, 2022
- Messages
- 4
- Office Version
- 365
- Platform
- MacOS
I have an Excel sheet with 12 columns and 4000+ rows. In Column E, I have a list of part numbers. These part numbers may or may not be repeated based on the city names found in Column F. For example, Part A (located in Column E) may be in 3 different rows: one row for City X, one row for City Y, and one row for City Z.
I would like to have a macro that goes through each part number and checks if there are 3 instances of that part number showing up: one associated with City X, one associated with City Y, and one associated with City Z.
If there are 3 instances, I would like the macro to make the cost the same for all the instances. The cost value is found in Column G.
If there are not 3 instances, I would like the macro to create a new row, or rows, and add the missing city, or cities in Column F to that row or rows.
Is this possible?
All columns start their data in Row 2 (Row 1 contains the headers).
Please view the attached images for a simplified example of what I currently have and what I'd like the end result to be.
Please let me know if you have any questions - I'd be happy to clarify.
I would like to have a macro that goes through each part number and checks if there are 3 instances of that part number showing up: one associated with City X, one associated with City Y, and one associated with City Z.
If there are 3 instances, I would like the macro to make the cost the same for all the instances. The cost value is found in Column G.
If there are not 3 instances, I would like the macro to create a new row, or rows, and add the missing city, or cities in Column F to that row or rows.
Is this possible?
All columns start their data in Row 2 (Row 1 contains the headers).
Please view the attached images for a simplified example of what I currently have and what I'd like the end result to be.
Please let me know if you have any questions - I'd be happy to clarify.
Attachments
Last edited by a moderator: