# Thread: Get Colorid based on the number of values passed

1. Registered User
Join Date
Dec 2014
Posts
1

## Unanswered: Get Colorid based on the number of values passed

Hi,

I have a requirement regarding a color combination data. I have a lookup table that holds a colorid, p1, p2, p3, p4 to p8 which will be having colors Red, Green and Amber. P1 to P8 columns holds these three colors based on their combinations.

I have attached the look up table data for reference.

I need to pass the color values to p1 to p8 and need to retrieve the color id based on the passed color.

If we pass values for all p1 to p8 then it is easy to get the color code, however it will not happen. The passed values may be dynamic. ie we will not have all 8 values all the times. sometimes we will have 2 colors passed, sometimes 5 colors will be passed.

If i pass only two colors say red and red, i need the color id of only the row that has red and red for p1 and p2 alone. i dont want want all the colorid's that has red and red in p1 and p2 and some other colors in p3 to p4.

The exact colorid of the combination must be returned on passing the values to p1 and p2.

To elaborate; I am passing Red and Red as values to P1 and P2. In the look up table we can have 10 rows that has red and red i p1 and p2 like

colorid p1 p2 p3 p4 p5 p6 p7 p8
1 red red
10 red red red
20 red red red
30 red red red red
40 red red red red red
50 red red red red red red
60 red red red red red red red
70 red red red red red red red red

So the result must have only the colorid 1 and not all the colorid's listed above. when I pass 3 red as values for p1, p2, p3 then the result must be 10. Colorid 1, 20, 30, 40, 50, 60 and 70 must not come in the result.

I need a function or procedure that will accept the arguments and provide me the result based on the values.

Can anyone help me with this?

https://www.dropbox.com/s/ltzcqslnbv...Data.xlsx?dl=0

2. www.gvee.co.uk
Join Date
Jan 2007
Location
UK
Posts
11,445