Forum Discussion
Merge 2 tables with same column name and duplicated products
- 4 years ago
Imrans123 & jbwtp Thank you both for your help! I ended up appending and filling the gaps in Excel with a "if empty, fill down" function, which solved 80% of my gaps. Then manually filling the remaing gaps. 😞
Probably the ugliest process ever, but it was only 500 rows of data.
I don't know why I thought there was an easy-button for that LOL
Firstly, I would start with a base table. I would append query as new, select the two tables and then remove duplicates from the Product column. This would ensure all the products from both tables are there but no duplicate products.
MY next challenge would be addressing the blank attributes. (i.e. Color, Size, Price and Range.)
On appended table, I would merge query with table1 (left outer) on product and then expand Color as Color1, Size as Size1 and so on.
Do a conditional column called color2, if Color is blank then Color1 else Color.
another column size2, if Size is blank then Size1 else size
and so on
This ensures all the attributes from table 1 are included in the columns color2, size2 ad so on. Now I want to bring in attributes from Table 2
I would merge query with table 2 (left outer) on product and then expand Color as Color3, Size as Size3 and so on.
Do a conditional column called color4, if Color2 is blank then Color3 else Color2.
another column size4, if Size2 is blank then Size3 else size2
and so on
After doing this Color4, Size4 and so on should have attributes from both table 1 and 2 while the appended table will have all unique products from both tables.
Rename Color4, Size4... to Color, Size and so on.