Find the nearest number using INDEX and MATCH but with more than one condition.

ed809

New Member
Joined
May 1, 2014
Messages
1
Example I have 2 sheets in a work book "ListA" with a table and "Main"

Sheet "ListA"

A B C
--------------
red 3 10
blue 2 11
red 4 12
red 1 8
blue 3 7

In my sheet "Main" I will like to find the nearest value in that table from "ListA" column "C", but also that the color is only blue.

A B
Color blue
Value 10

I was doing: =INDEX(ListA!B1:B5,MATCH(MIN(ABS(ListA!C1:C5-Main!B2)),ABS(ListA!C1:C5-Main!B2),0)) but I didnt find how to include the color "Row A" on my conditions the value on Main!B1

Thanks in advance
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi and welcome to Mr Excel

Maybe this array formula

=INDEX(ListA!$B$1:$B$5,MATCH(MIN(IF(ListA!$A$1:$A$5=B1,ABS(ListA!C1:C5-B2))),IF(ListA!$A$1:$A$5=B1,ABS(ListA!C1:C5-B2)),0))

Ctrl+Shift+Enter

Hope this helps

M.
 
Upvote 0
Colorblue
Value10
2

<COLGROUP><COL style="WIDTH: 48pt" span=2 width=64><TBODY>
</TBODY>

main, A4, control+shift+enter, not just enter:
Rich (BB code):
=INDEX(ListA!$B$2:$B$6,
  MATCH(MIN(ABS(IF(ListA!$A$2:$A$6=B1,ListA!$C$2:$C$6,9.99999999999999E+307)-B2)),
  ABS(IF(ListA!$A$2:$A$6=B1,ListA!$C$2:$C$6-B2)),0))
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,657
Members
449,462
Latest member
Chislobog

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