forum.ozgrid.com/index.php?attachment/67720/
Hi folks!
When connecting ThisWorkbook using ADODB I get following error:
[ATTACH=CONFIG]67719[/ATTACH]
The Source string for recordset printed in immediate window is as follows:
SQL
SELECT
CASE WHEN [ITEM1] = "CD36917" AND [SUBGROUP] Like "0999%" AND [LINE CODE] = "XY00000ZS2N8WV1" AND [GROUP1] Like "%555%" THEN "ABC" WHEN [ITEM1] = "KM39352" AND [LINE CODE] = "XY00000ZS36W4" AND [GROUP1] Like "%555%" THEN "DEF" WHEN [ITEM1] = "VW40341" AND [SUBGROUP] Like "0999%" AND [GROUP1] Like "%555%" THEN "GHI" WHEN [LINE CODE] = "XY00000ZS2N8WV1" AND [GROUP1] Like "%555%" THEN "JKL" WHEN [ITEM1] = "LB789516" THEN "MNO" WHEN [LINE CODE] = "ZZ00000TV37Z6" AND [GROUP1] Like "%555%" THEN "PQR" WHEN [CITY] = "PARIS" THEN "STU"
END
FROM [data$]
What macro shall do:
1. Go through every row on data sheet.
2. For that row, run a loop of every category combination on lookup_ref sheet
3. Take the category which meets most of the criteria on ref sheet and paste that from Ref onto data sheet, col H.
4. If more category rows meet the logic per particular data row (like row 4 = either MNO or STU) then take the last one (STU)
> unfortunately, data cannot be organized different way.