Using INDEX MATCH MATCH to find next "possible" value in array

evanseabrook

New Member
Joined
Dec 18, 2017
Messages
3
I have a table that contains Limits($), Zones and the resulting charge amount.

ABCDE
1Limit$10000$15000$20000$25000
2Zone 1$10$20$30n/a
3Zone 2$10n/an/an/a

<tbody>
</tbody>

I have the above table. I want to pass in a zone number and a limit amount. If the resulting charge is "n/a", I want to return the charge amount for that zone that isn't "n/a" along with the associated Limit value.

I'm able to return the charge amount for a passed in zone number and limit amount with no problems. I've been playing around with an INDEX MATCH MATCH formula but I'm spinning my wheels.

In the below formula:
T1 contains the limit amount
V1 contains the zone number.
Z1 is the charge amount that is returned when I pass in the zone number and limit amount.

The below formula is for a second column to handle the n/a in sort of a what if scenario.

=INDEX('externaltable'!$B$2:$E$3,MATCH(V1,'externaltable!'$A$2:$A$3),IF(Z1="n/a",MAX('externaltable'!$B$1:$E$1),MATCH(T1,'externaltable'!$B$17:$M$17)))
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try to provide the input values of T1, V1, and Z1 along with the expected value.

T1 = 20000
V1 = Zone 2
Z1 = n/a

Passing these values in, I expect to get back $10 and 10000 respectively.

I guess a better explanation is I'm trying to use 2 formulas. One to return the highest charge for the particular zone and the other to return the associated limit.
 
Upvote 0
Control+shift+enter, not just enter:

=MAX(IF($B$1:$E$1<=T1,IF(ISNUMBER(INDEX($B$2:$E$3,MATCH(V1,$A$2:$A$3,0),0)),INDEX($B$2:$E$3,MATCH(V1,$A$2:$A$3,0),0))))
 
Upvote 0
Control+shift+enter, not just enter:

=MAX(IF($B$1:$E$1<=T1,IF(ISNUMBER(INDEX($B$2:$E$3,MATCH(V1,$A$2:$A$3,0),0)),INDEX($B$2:$E$3,MATCH(V1,$A$2:$A$3,0),0))))


Works like a charm for the charm! Thanks! I think I'm following along with what's going on, but I also want to return the corresponding limit? Is it similar?
 
Upvote 0
Works like a charm for the charm! Thanks! I think I'm following along with what's going on, but I also want to return the corresponding limit? Is it similar?

I forgat to include that. Yes it's similar:

Control+shift+enter:

=MAX(IF($B$1:$E$1<=T1,IF(ISNUMBER(INDEX($B$2:$E$3,MATCH(V1,$A$2:$A$3,0),0)),$B$1:$E$1)))
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,384
Members
449,080
Latest member
Armadillos

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