I have an MS Access table that contains colour codes and their relevant percentage with reference to particular products. Each product can be made up of up to 3 colours and I am trying to determine the most used colour for each product - so far I can determine the percentage of the highest colour (using a MaxOfList VBA module), but am unable to associate it with the actual colour.
Table example:
ProductID ColourCode1 Colour1Proportion ColourCode2 Colour2Proportion ColourCode3 Colour3Proportion Highest 1 Col034 100 100 2 Col023 25 Col241 50 Col065 25 50 3 Col024 17 Col211 23 Col360 60 60
So as an example, product 001 would return Col034, product 002 would return Col241 and product 003 would return Col360.
The colour codes are as they stand i.e. they do not refer to another table to return a 'real-world' colour, and there isn't a rule on the order by which the the codes should be entered. This is a fully normalised table.
Essentially I need something that performs a Vlookup on the Highest column, and returns the value which is 1 field to the left of the result. Unfortunately a dlookup won't help me here.
I've toyed with the idea of creating temporary tables for each listed block of colour-related columns (e.g. ColourCode1 and ColourProportion1 in one table, ColourCode2 and ColourProportion2 in another etc) and trying to sort these for each ProductID, but I don't think that would help.
Any ideas / pointers would be greatly appreciated!