phonesdontfly
New Member
- Joined
- Mar 2, 2016
- Messages
- 16
Hello,
I have a sheet ("Product") that has unique identifiers (PROD_ID) for each product in my database.
And I have another sheet, called "Images", that has all the images associated with each product. Many products have multiple images, and thus have multiple rows with the same Prod_IDs in my "Images" Sheet.
I need to find a way to pull in the image URL (or multiple URLs) associated with each Product and then place them into my "Product" Sheet.
When there are multiple images for a product, they need to go on a blank row underneath the primary image row (as shown in the [Desired] Sheet 1 example below).
[Current] Sheet 1 (Products)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]PROD_ID[/TD]
[TD]Product Name[/TD]
[TD]Image URL[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]widget1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]widget2[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Sheet 2 (Images)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Prod_ID[/TD]
[TD]IMAGE_URL[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]image1a.jpg[/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]image9.jpg[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]image1b.jpg[/TD]
[/TR]
</tbody>[/TABLE]
[Desired] Sheet 1 (Products)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]PROD_ID[/TD]
[TD]Product Name[/TD]
[TD]Image URL[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]widget1[/TD]
[TD]image1a.jpg[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]widget1[/TD]
[TD]image1b.jpg[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]widget1[/TD]
[TD]image1c.jpg[/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]widget2[/TD]
[TD]image9.jpg[/TD]
[/TR]
</tbody>[/TABLE]
---
My first/only thought was to use a VLOOKUP to find the Prod ID and then pull the corresponding Image URL, however that only works for the first match, and unfortunately I have multiple matching results here.
I'm also not sure how to automatically create a blank row when adding the multiple images for a product.
I'm guessing there's some way with VBA to loop through and automate this (as there's several thousand rows of data), but I'm not totally sure where to start. Does anyone know of a way to do this?
Thanks!
I have a sheet ("Product") that has unique identifiers (PROD_ID) for each product in my database.
And I have another sheet, called "Images", that has all the images associated with each product. Many products have multiple images, and thus have multiple rows with the same Prod_IDs in my "Images" Sheet.
I need to find a way to pull in the image URL (or multiple URLs) associated with each Product and then place them into my "Product" Sheet.
When there are multiple images for a product, they need to go on a blank row underneath the primary image row (as shown in the [Desired] Sheet 1 example below).
[Current] Sheet 1 (Products)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]PROD_ID[/TD]
[TD]Product Name[/TD]
[TD]Image URL[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]widget1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]widget2[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Sheet 2 (Images)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Prod_ID[/TD]
[TD]IMAGE_URL[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]image1a.jpg[/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]image9.jpg[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]image1b.jpg[/TD]
[/TR]
</tbody>[/TABLE]
[Desired] Sheet 1 (Products)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]PROD_ID[/TD]
[TD]Product Name[/TD]
[TD]Image URL[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]widget1[/TD]
[TD]image1a.jpg[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]widget1[/TD]
[TD]image1b.jpg[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]widget1[/TD]
[TD]image1c.jpg[/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]widget2[/TD]
[TD]image9.jpg[/TD]
[/TR]
</tbody>[/TABLE]
---
My first/only thought was to use a VLOOKUP to find the Prod ID and then pull the corresponding Image URL, however that only works for the first match, and unfortunately I have multiple matching results here.
I'm also not sure how to automatically create a blank row when adding the multiple images for a product.
I'm guessing there's some way with VBA to loop through and automate this (as there's several thousand rows of data), but I'm not totally sure where to start. Does anyone know of a way to do this?
Thanks!
Last edited: