Index Match Not returning expected answer

ddocg

Board Regular
Joined
Jun 22, 2002
Messages
145
Hi,

I am using the following formula:

=INDEX(D4:D35,MATCH(MIN(ABS(D4:D35-B13)),ABS(D4:D35-B13),-1))

Cell B13 contains the number 660

My array contains the following list sorted into descending order:

[TABLE="width: 64"]
[TR]
[TD="class: xl63, width: 64"]4680[/TD]
[/TR]
[TR]
[TD="class: xl63"]4100[/TD]
[/TR]
[TR]
[TD="class: xl63"]3330[/TD]
[/TR]
[TR]
[TD="class: xl63"]2900[/TD]
[/TR]
[TR]
[TD="class: xl63"]2530[/TD]
[/TR]
[TR]
[TD="class: xl63"]2430[/TD]
[/TR]
[TR]
[TD="class: xl63"]2210[/TD]
[/TR]
[TR]
[TD="class: xl63"]2020[/TD]
[/TR]
[TR]
[TD="class: xl63"]1980[/TD]
[/TR]
[TR]
[TD="class: xl63"]1900[/TD]
[/TR]
[TR]
[TD="class: xl63"]1800[/TD]
[/TR]
[TR]
[TD="class: xl63"]1640[/TD]
[/TR]
[TR]
[TD="class: xl63"]1490[/TD]
[/TR]
[TR]
[TD="class: xl63"]1470[/TD]
[/TR]
[TR]
[TD="class: xl63"]1370[/TD]
[/TR]
[TR]
[TD="class: xl63"]1330[/TD]
[/TR]
[TR]
[TD="class: xl63"]1280[/TD]
[/TR]
[TR]
[TD="class: xl63"]1220[/TD]
[/TR]
[TR]
[TD="class: xl63"]1210[/TD]
[/TR]
[TR]
[TD="class: xl63"]1100[/TD]
[/TR]
[TR]
[TD="class: xl63"]1060[/TD]
[/TR]
[TR]
[TD="class: xl63"]974[/TD]
[/TR]
[TR]
[TD="class: xl63"]869[/TD]
[/TR]
[TR]
[TD="class: xl63"]847[/TD]
[/TR]
[TR]
[TD="class: xl63"]792[/TD]
[/TR]
[TR]
[TD="class: xl63"]750[/TD]
[/TR]
[TR]
[TD="class: xl63"]692[/TD]
[/TR]
[TR]
[TD="class: xl63"]649[/TD]
[/TR]
[TR]
[TD="class: xl63"]591[/TD]
[/TR]
[TR]
[TD="class: xl63"]566[/TD]
[/TR]
[TR]
[TD="class: xl63"]534[/TD]
[/TR]
[TR]
[TD="class: xl63"]504


[/TD]
[/TR]
[/TABLE]
My expectation was for the formula to return 692 however it doesn't, using either type 0 or -1 always returns 649 and type 1 returns N\A regardless of how the array is sorted.

I'd very much appreciate if someone could explain what I need to do, to get the formula to return 692 i.e. Match Type -1 [FONT=&quot]MATCH finds the smallest value greater than or equal to lookup value. Lookup array must be sorted in descending order.

Kind regards
Dave.[/FONT]
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Your Cells in the first column below are in Cells C30,C31, & C32


692 32 27
649 -11 28
591 -69 29


Where the ABS(-11) returns the Minimum 11, which the match returns the 28th number or 649.
 
Upvote 0
Thanks for your reply Jim,

I maybe wasn't clear in my original question.

Perhaps I'm using the wrong formula? I have obviously misunderstood the use of -1 at the end of my formula. My understanding was that using -1 would result in:

finds the smallest value greater than or equal to lookup value. Lookup array must be sorted in descending order.

As my lookup value is 660 and with the above in mind, I would expect 692 to be returned but as you point out it returns 649.

Any advice on how I get it to output 692 which would be the smallest value greater than the lookup value?

Kind regards
Dave
 
Upvote 0
Try this array formula. Enter with CTRL-SHIFT-ENTER.
Excel Workbook
BCD
46924680
54100
63330
72900
82530
92430
102210
112020
121980
136601900
141800
151640
161490
171470
181370
191330
201280
211220
221210
231100
241060
25974
26869
27847
28792
29750
30692
31649
32591
33566
34534
35504
Sheet
 
Upvote 0
Actual I think one of these shorter formulas will do what you want:

If you have a later ver. of Excel with the MINIFS function then the formula in B4. If not then the formula in B6 that must be entered with CTRL-SHIFT-ENTER.
Excel Workbook
ABCD
46924680
54100
66923330
72900
82530
92430
102210
112020
121980
136601900
141800
151640
161490
33566
34534
35504
Sheet
 
Upvote 0
Thanks AhoyNC your first example formula is exactly what I was looking for. I really appreciate you taking the time in providing it.

Edit, I missed your follow up post providing further examples, this is just awesome, I'll have a look at those, again, many thanks.

Kind regards
Dave
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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