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.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Limit[/TD]
[TD]$10000[/TD]
[TD]$15000[/TD]
[TD]$20000[/TD]
[TD]$25000[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Zone 1[/TD]
[TD]$10[/TD]
[TD]$20[/TD]
[TD]$30[/TD]
[TD]n/a[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Zone 2[/TD]
[TD]$10[/TD]
[TD]n/a[/TD]
[TD]n/a[/TD]
[TD]n/a[/TD]
[/TR]
</tbody>[/TABLE]

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

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.
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,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

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