Match Index with if and function for dataset in defined range

trudon01

New Member
Joined
Sep 13, 2017
Messages
2
Hi everyone,

I'm trying to extract a specific range of values (coordinates X in this case) from a given dataset, using the index match function.
The lookup needs to display each coordinate within that range successively. The function works if the and function and one of the conditions is removed, but not with both.

Any ideas as to what I'm doing wrong?


[TABLE="width: 500"]
<tbody>[TR]
[TD]X[/TD]
[TD]Y[/TD]
[TD]Z[/TD]
[TD][/TD]
[TD]Limits[/TD]
[TD]Z[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9143.991[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7289.529[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1395.194[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"]Upper[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64, align: right"]1411[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"]{=INDEX($A$2:$C$98,MATCH(0,IF(AND($F$2>=$C$2:$C$98,$F$3<=$C$2:$C$98),COUNTIF($H$1:$H1,$A$2:$A$98),""),0),1)}[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9142.708[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7450.554[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1406.76[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD]Lower[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64, align: right"]1408.359[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"]{=INDEX($A$2:$C$98,MATCH(0,IF(AND($F$2>=$C$2:$C$98,$F$3<=$C$2:$C$98),COUNTIF($H$1:$H2,$A$2:$A$98),""),0),1)}[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9141.267[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7466.744[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="class: xl65, width: 66, align: right"]1408.359[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"]{=INDEX($A$2:$C$98,MATCH(0,IF(AND($F$2>=$C$2:$C$98,$F$3<=$C$2:$C$98),COUNTIF($H$1:$H3,$A$2:$A$98),""),0),1)}[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9138.91[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7493.216[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1409.407[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9136.395[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7374.848[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1400[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9134.054[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7523.171[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1411.755[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9127.053[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7566.355[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1412.451[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9122.349[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7578.854[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1412.004[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9113.401[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7602.633[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="class: xl65, width: 66, align: right"]1410.763[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9104.005[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7613.578[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="class: xl65, width: 66, align: right"]1409.307[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9088.181[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7632.145[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="class: xl65, width: 66, align: right"]1408.359[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9065.29[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7660.803[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1401.617[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9056.56[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7673.477[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1400[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9034.104[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7685.028[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1397.697[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-9031.84[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="width: 77, align: right"]-7688.68[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 66"]
<tbody>[TR]
[TD="width: 66, align: right"]1397.42[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
etc

Thanks for trying to assist in advance.

Rgds
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi Aladin,

The formula mentioned is given in the spreadsheet above (albeit the spreadsheet changed formatting upon posting).
I currently have a large database of coordinates XYZ.
The aim was to define the upper and lower elevation (Column E) values, and subsequently extract all the X then Y (Column A & B) values in that range.

I found that this works, but duplicates all results.
=INDEX($A$2:$C$98,MATCH(1,(IF($F$2>=$C$2:$C$98,COUNTIF($H$1:$H1,$A$2:$A$98),""))*(IF($F$3<=$C$2:$C$98,COUNTIF($H$1:$H1,$A$2:$A$98),""))),0)

Any suggestions?

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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