Using INDEX with non-contiguous ranges

HighAndWilder

Well-known Member
Joined
Nov 4, 2006
Messages
712
Office Version
  1. 365
Platform
  1. Windows
I'd like to be able to use INDEX with non-contiguous ranges.

In this example I would like the formula to return 17 but it returns 10.

Maybe the question should be, how can I return 17 from the two non-contiguous ranges when I know the row and column numbers.

The numbers will not always be unique.

I have not come across this kind of range reference before.

Thanks for any pointers in the right direction.

Version 2.xlsm
ABCDEFGHI
1
21234567
3891011121314
415161718192021
5
6
722232425262728
8
929303132333435
10
1110
12
NCR
Cell Formulas
RangeFormula
B11B11=INDEX($B$2:$H$2:$B$4:$H$4:$B$7:$H$7:$B$9:$H$9,2,3)
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hello, you could e.g. use CHOOSEROWS:

Excel Formula:
=INDEX(CHOOSEROWS(B2:H9,1,3,6,8),2,3)
 
Upvote 0
.. or a bit more like the syntax that you were trying

Excel Formula:
=INDEX(VSTACK(B2:H2,B4:H4,B7:H7,B9:H9),2,3)
 
Upvote 0
Another option directly with index
INDEX(reference, row_num, column_num, area_num)
So ..
Excel Formula:
=INDEX((B2:H2,B4:H4,B7:H7,B9:H9),1,3,2)
 
Upvote 0
Another option where:
row index= 2
col index = 3
number of col of dataset= 7
Note: this won't work if you have blanks in your data rows.
Book1
ABCDEFGH
1
21234567
3891011121314
415161718192021
5
6
722232425262728
8
929303132333435
10
1110
Sheet3
Cell Formulas
RangeFormula
B11B11=INDEX(TOCOL(B2:H9,1),(2-1)*7+3)
 
Upvote 0
A more robust way
Excel Formula:
=INDEX(FILTER(B2:H9,BYROW(B2:H9<>"",OR)),2,3)
 
Upvote 0
Yes, simply change 2 to 3 in both.
That does not seem logical or very user-friendly to me. For both of your formulas then to get the value from the third column of ..
  • the 4th range you would use 5
  • the 3rd range you would use 4
  • the 2nd range you would use 3
    but for
  • the 1st range you would have to use 1
 
Upvote 0
I'm not following what you mean.
Book1
BCDEFGH
1
21234567
3891011121314
415161718192021
5
6
722232425262728
8
929303132333435
10
11RowColOption1Option2
121111
131222
141333
151444
161555
171666
181777
192188
202299
21231010
22241111
23251212
24261313
25271414
26311515
27321616
28331717
29341818
30351919
31362020
32372121
33412222
34422323
35432424
36442525
37452626
38462727
39472828
40512929
41523030
42533131
43543232
44553333
45563434
46573535
Sheet3
Cell Formulas
RangeFormula
B12:B46B12=ROUNDUP(SEQUENCE(35)/7,0)
D12:D46D12=INDEX(TOCOL($B$2:$H$9,1),(B12-1)*7+C12)
E12:E46E12=INDEX(FILTER($B$2:$H$9,BYROW($B$2:$H$9<>"",OR)),B12,C12)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
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