AINDEXER

AINDEXER(Array,[Column_Numbers])
Array
Required. Range to return row or column numbers.
[Column_Numbers]
Optional. 1☛ return column numbers; 0 or ignored☛ return row numbers.

AINDEXER returns all relative row numbers for each column or all relative column numbers for each row in an array. Uses MAKEARRAY!

schardt679

Board Regular
Joined
Mar 27, 2021
Messages
58
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
AINDEXER returns all relative row numbers for each column or all relative column numbers for each row in an array. Uses MAKEARRAY!

Thanks to Rico S's ARRAYCOLUMNS & ARRAYROWS for the inspiration (from Mr. Excel's UNIQUE of Rectangular Range Using MAKEARRAY in Excel - 2416).
ARRAYCOLUMNS(Array) =LAMBDA(array,SEQUENCE(,COLUMNS(array))*SEQUENCE(ROWS(array),1,1,0)).
ARRAYROWS(array) =LAMBDA(array,SEQUENCE(ROWS(array))*SEQUENCE(,COLUMNS(array),1,0)).
Calls CELLCOUNT.
Other functions on minisheet: AFORMULATEXT.

Screen Tip/ Comment: =AINDEXER(Array☛ range to return row/column numbers, [Column_Numbers]☛ 1=return column numbers; 0/❎=return row numbers✅) ⁂[]=optional; ✅=default; ❎=omit

Excel Formula:
=LAMBDA(Array,[Column_Numbers],
      LET(Arr, Array,          Col?, Column_Numbers,
             ColScan, AND(Col?<>{1,0}),          ColMSG, "Column_Numbers=1,0",
             RowCt, CELLCOUNT(Arr, 1),          ColCt, CELLCOUNT(Arr, 2),
             Result, MAKEARRAY(RowCt, ColCt, LAMBDA(R,C, IF(Col?, C,  R))),
             Return, IF(ColScan, ColMSG,  Result),
             Return
     )
  )
LAMBDA Examples.xlsx
ABCDEFGHI
1AINDEXER
2
3Original DataColumn_NumbersResult
41#VALUE!011
5222
63833
74944
851055
9
10Row numbers are returned
11Formula in cell G4☛ =AINDEXER(B4:C8, E4)
12
13
14
15AINDEXER
16
17Original DataColumn_NumbersResult
181#VALUE!112
19212
203812
214912
2251012
23
24Column numbers are returned
25Formula in cell G18☛ =AINDEXER(B18:C22, E18)
26
AINDEXER
Cell Formulas
RangeFormula
G4:H8,G18:H22G4=AINDEXER(B4:C8, E4)
B11,B25B11=AFORMULATEXT(G4)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,575
Messages
6,173,148
Members
452,502
Latest member
PQCurious

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