Please help me regarding extracting results from 3 nearest value /criteria

xtian1990

New Member
Joined
Jul 1, 2016
Messages
3
Good day! Here's my problem, that i can't really find the solution.

I have a table simmlar to this,

Color nameRGB
Cream252255217
Magenta2220237
Pink25592217
Lilac151116204

<tbody>
</tbody>

I have 150 of these colors.

I'm planning to make 3 inputs as my lookup value, and look for this table to match the nearest RGB value and give me the color name as the result.

I can make it with index and match, but with exact RGB values only, but I need the nearest RGB values. Please help me.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Does this work?


Excel 2010
ABCD
1Color nameRGB
2Cream252255217
3Magenta2220237
4Pink25592217
5Lilac151116204
6
7
8
9Required
10R200
11G50
12B150
13
14Suggested ColorMagenta
15R222
16G0
17B237
Sheet1
Cell Formulas
RangeFormula
B15=INDEX($B$2:$D$5,MATCH($B$14,$A$2:$A$5,0),MATCH($A15,$B$1:$D$1,0))
B16=INDEX($B$2:$D$5,MATCH($B$14,$A$2:$A$5,0),MATCH($A16,$B$1:$D$1,0))
B17=INDEX($B$2:$D$5,MATCH($B$14,$A$2:$A$5,0),MATCH($A17,$B$1:$D$1,0))
B14{=INDEX(A2:A5,MATCH(MIN(ABS(B2:B5-B10)+ABS(C2:C5-B11)+ABS(D2:D5-B12)),ABS(B2:B5-B10)+ABS(C2:C5-B11)+ABS(D2:D5-B12),0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Well it will work but!!!

Is the method for returning the closest match correct?

The formula subtracts the required RGB from each of the listed RGBs and sums the difference.

It then returns the colour whos total sum is the smallest.
 
Upvote 0
I did that before by creating helping columns, subtracting then getting smallest sums, but did not showed good results. But your formula seems better, im trying many color now and worked fine, really close results. Maybe i did something wrong on my first method. Thank you very much :)
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top