As shown in the image above, I’m trying to achieve a result as shown in AFTER table from the data in BEFORE table.
These are what I want us to achieve:
- Uniquely transpose department from columns into rows
- Uniquely List all vendor that is tired to each location, office and department – separated by comma for multiple vendors
I have so far been able to write a sub routine that is able to copy the department data and transpose it, but I’m stock moving forward.
Range("D4:D18").Select Range("D4:D18").Sort key1:=Range("D4"), _ order1:=xlAscending, Header:=xlNo Selection.Copy Range("CJ3").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Application.CutCopyMode = False
and giving it a try on mySQL:
SELECT DISTINCT location, department, office, GROUP_CONCAT(vendor) as vendor FROM `tbl_dep_ven_location` WHERE department = 'Procurement' and location = 'Femty' GROUP BY office ORDER by depterment