INDEX.NTH(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty])
lookup_1D_array
Required. Specifies the function input and can be a cell or one-dimensional range or array.
nth_elements
Required. Specifies the positional number(s) of the "lookup_1D_array" element(s) to be returned in the output and can be a single number or multiple numbers.
every
Optional. Specifies whether to return "every" nth element(s) and takes two arguments: 0 or omitted or FALSE, for "off" (meaning "not every"); and 1 or TRUE or any number other than 0, for "on" (meaning "every").
start_at
Optional. Specifies the starting lookup position in the lookup_1D_array and takes a single number as argument.
output_orientation
Optional. Specifies the orientation of the output spill of the nth_elements and takes three arguments: 0 or omitted, for spill in the same orientation as the lookup_1D_array; 1, for horizontal spill; and 2, for vertical spill.
output_style
Optional. Specifies the output style of the function if the "every" parameter is turned on and takes three arguments: 0 or omitted, for default output showing the two-dimensional spill of nth_elements and every nth_elements; 1, for linearization of the default two-dimensional spill by stacking the primary (nth_elements) spills; and 2, for linearization of the default two-dimensional spill by stacking the secondary (every nth_elements) spills.
exclude_types
Optional. Specifies the type(s) of data that can be excluded from the main output and takes one or more of twenty-four arguments: 1, for number; 2, for text; 3, for blank; 4, for logical; 16, for error; 31, for real blank; 32, for formula blank; 41, for TRUE; 42, for FALSE; 160, for #EXTERNAL! error; 161, for #NULL! error; 162, for #DIV/0! error; 163, for #VALUE! error; 164, for #REF! error; 165, for #NAME? error; 166, for #NUM! error; 167, for #N/A error; 168, for #GETTING_DATA error; 169, for #SPILL! error; 1610, for #CONNECT! error; 1611, for #BLOCKED! error; 1612, for #UNKNOWN! error; 1613, for #FIELD! error; 1614, for #CALC! error.
include_types
Optional. Specifies the type(s) of data that can be included in the main output and takes one or more of twenty-four arguments: 1, for number; 2, for text; 3, for blank; 4, for logical; 16, for error; 31, for real blank; 32, for formula blank; 41, for TRUE; 42, for FALSE; 160, for #EXTERNAL! error; 161, for #NULL! error; 162, for #DIV/0! error; 163, for #VALUE! error; 164, for #REF! error; 165, for #NAME? error; 166, for #NUM! error; 167, for #N/A error; 168, for #GETTING_DATA error; 169, for #SPILL! error; 1610, for #CONNECT! error; 1611, for #BLOCKED! error; 1612, for #UNKNOWN! error; 1613, for #FIELD! error; 1614, for #CALC! error.
replace_with
Optional. Specifies a single entry of any desired data type (i.e. number, text, blank, logical, or error) that can be used to replace any entries that were either directly excluded via the exclude_types parameter or indirectly excluded via the include_types parameter.
if_empty
Optional. Specifies a single entry of any desired data type (i.e. number, text, blank, logical, or error) that can be displayed as the main function output if the output is empty.

INDEX.Nth returns (every) nth element(s) (starting at the desired position) from a one-dimensional array and provides output options and full control over data type(s) inclusion/exclusion

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
578
Office Version
  1. 365
Platform
  1. Windows
INDEX.Nth returns (every) nth element(s) (starting at the desired position) from a one-dimensional array and provides output options and full control over data type(s) inclusion/exclusion

(The code is modular (as all my other functions) allowing for easy swapping/optimizing over time. See all the modules below in VBA wraps and in XL2BB, after the description; and download the template containing all my functions from the link below in my signature)

INDEX.Nth takes ten parameters, two required and eight optional, as follows:
A) The first parameter, lookup_1D_array, required, specifies the function input, i.e. a one-dimensional array, that is used for the lookup and can be a cell or one-dimensional range or array

B) The second parameter, nth_elements, required, specifies the positional number(s) of the input element(s) to be returned in the output and can be a single number or multiple numbers

Note that if multiple elements are sought, the numbers should be provided in array brackets "{}" (e.g. {1,2,3} or {2,1,6,8,4} or {1,2,2,2,4,3,5,5})

Note that if the one or more specified nth element numbers are all larger than the length of the lookup array, the function will return an #N/A. If, however, one or some of the numbers are larger than the lookup array, then those numbers will be automatically filtered out of the entire function's analysis and will, therefore, not affect the output in any way.

Note that the numbers can be in any order desired and/or repeated as shown in the example above

Note that if the numbers are repeated, the they will be reflected in the function output depending on which output_style is specified (see section F below)

Note that seeking multiple elements, if available, will result in a spill. The orientation of this spill (which I refer to as the primary spill) is controlled by the fifth parameter, i.e. output_orientation, as described in section E below

C) The third parameter, every, optional, specifies whether to return "every" nth element(s) (specified in the second parameter in section B above) and takes two general arguments:
0 or omitted or FALSE, for off (meaning "not every") (i.e. only the first of the nth element(s) will be returned)
1 or TRUE or any number other than 0, for on (meaning "every") [i.e. every (available) nth element(s) will be returned]

Note that this argument structure matches the Excel's native way of handling on/off arguments for parameters and is accomplished by my PLSL module shown below

Note that seeking every nth element(s), will result in the subsequent nth element(s) to have a secondary spill perpendicular to the direction of the main spill of the first set of nth element(s). This happens only when the sixth parameter, i.e. output_style, is omitted or 0. If output_style is set to 1 or 2, both the primary and secondary spills will combine one-dimensionally in the orientation of the primary spill. See section F below

D) The fourth parameter, start_at, optional, specifies the starting lookup position in the input lookup_1D_array and takes a single number (integer) as argument

Note that if omitted, (i.e. default) the function will consider the beginning element of the one-dimensional range/array as the first position to begin scanning

Note that if more than one number is entered through the array brackets, the function will return a single #N/A

Note that if the entered number is larger than the length of the lookup array, the function will return a single #N/A. For this assessment, the function automatically factors in the (specified) starting lookup position

E) The fifth parameter, output_orientation, optional, specifies the orientation of the output spill of the nth_elements and takes three arguments:
0 or omitted, for spill in the same orientation as the one-dimensional lookup range/array
1, for horizontal spill
2, for vertical spill

Note that this orientation refers to the spill of the nth elements (i.e. the primary spill) and not the perpendicular spill generated by using "every" (i.e. the secondary spill) as described in sections B and C above

F) The sixth parameter, output_style, optional, specifies the output style of the function if the "every" parameter is turned on and takes three arguments
0 or omitted, for default output showing the two-dimensional spill of nth_elements and every nth_elements, as described in sections B, C, and E above
1, for linearization of the default two-dimensional spill by stacking the primary (nth_elements) spills
2, for linearization of the default two-dimensional spill by stacking the secondary (every nth_elements) spills

Note that both arguments 1 and 2 will result in the same size of linear output; the difference is in the linearization method

Note that for both arguments 1 and 2, while linearizing the default two-dimensional spill, the function will automatically exclude any blank cells that are not part of the lookup_1D_array (i.e. the non-core blank cells) (see example in one of the attached XL2BBs where the non-core blank cells are highlighted in gray); this means that the overall size of the function output with arguments 1 or 2 may be smaller than the size of the output with argument 0 (or omitted).

Note that if "every" is not turned on, the use of this, i.e. output_style, parameter will have no effect on the function output

Note that if any number other than 0 (or omitted), 1, or 2 is used for this parameter, the function will return an #N/A

G) The seventh parameter, exclude_types, optional, specifies the type(s) of data that can be excluded from the main output and takes one or more of twenty-four arguments:
1, for number
2, for text
3, for blank
4, for logical
16, for error
31, for real blank
32, for formula blank
41, for TRUE
42, for FALSE
160, for #EXTERNAL! error
161, for #NULL! error
162, for #DIV/0! error
163, for #VALUE! error
164, for #REF! error
165, for #NAME? error
166, for #NUM! error
167, for #N/A error
168, for #GETTING_DATA error
169, for #SPILL! error
1610, for #CONNECT! error
1611, for #BLOCKED! error
1612, for #UNKNOWN! error
1613, for #FIELD! error
1614, for #CALC! error

Note that if you need to enter more than one argument, you need to use the array brackets "{}" such as {1,31} for excluding numbers and real blanks, respectively, or {16,2,4} for excluding errors, texts, and logicals, respectively; see the attached XL2BB examples (the number of types permutations is huge; I have only shown a few examples); this parameter as well as the next (include_types) allow for a remarkable level of flexibility and full resolution for managing data types in the function output

Note that excluding type(s) may cause the output spill to auto-shrink if full row(s) and/or column(s) in the original (unexcluded) spill get vacated by the exclusion. (The auto-shrink happens leftward and upward, i.e. towards the top-left corner of the output spill)

Note that the auto-shrink happens no matter which output_style is used. For output_style 0 (or omitted), the auto-shrink may happen two-dimensionally or one-dimensionally depending on the type of data in the lookup array and the excluded type(s). For output_style 1 or 2, the auto-shrink will happen one-dimensionally.

Note that the numbers included in the array brackets for excluding types don't have to be in any order, as shown in the example above

Note that the same principles specified for exclude_types apply to the include_types parameter as described below in section H

H) The eighth parameter, include_types, optional, specifies the type(s) of data that can be included in the main output and takes one or more of twenty-four arguments, exactly like the seventh parameter in section G above

Note that both exclude_types and include_types cannot be used simultaneously

Note that using include_types (unless all types are included as by {1,2,3,4,16} for example) may also cause the main output spill to auto-shrink depending on whether full row(s) or column(s) get vacated by the indirect exclusion caused by using this parameter. See section G above for additional information especially on the auto-shrink capability of the function.

I) The ninth parameter, replace_with, optional, specifies a single entry of any desired data type (i.e. number, text, blank, logical, or error) that can be used to replace any entries that were either directly excluded via the exclude_types parameter or indirectly excluded via the include_types parameter

Note that if you use the replace_with parameter by itself, i.e. without using one of exclude_types or include_types, the function will crash with a single #N/A

Note that if more than one entry is included in this parameter via array brackets "{}", the function will crash with a single #N/A

J) The tenth parameter, if_empty, optional, specifies a single entry of any desired data type (i.e. number, text, blank, logical, or error) that can be displayed as the main function output if the output is empty, i.e. #CALC! with the message "Empty arrays are not supported"

Note that if the function output contains #CALC! which comes from an existing entry in the function input, then you will see the message "This #CALC! error comes from a precedent to this formula". This implies that this particular type of output is not actually "empty", and therefore, if there is an entry in the if_empty parameter, this entry will not be shown

Note that if more than one entry is included in this parameter via array brackets "{}", the function will crash with a single #N/A

Note that the "empty" status of the output as well as the use of if_empty, if supplied, is controlled by my JAI module described below (I have adopted the JXX naming pattern for my modules and helper functions as there are the fewest number of built-in Excel functions starting with the letter J)

INDEX.Nth
VBA Code:
=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],
   LET(
      i,ROWS(lookup_1D_array),
      j,COLUMNS(lookup_1D_array),
      m,MAX(i,j),
      e,PLSL(every),
      o,PLS(PO0(output_orientation)),
      s,PLS(PO0(output_style)),
      f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),
      r,ROWS(f),
      n,FILTER(TOROW(nth_elements),nth_elements<=r),
      a,TOROW(XTYPE(lookup_1D_array,3)),
      w,JAD(e,start_at,n,r,s),
      x,JAE(f,w),
      p,JAE(a,w),
      v,IF(OR(AND(i=1,j=1),i>j),0,1),
      IF(
         AND(i>1,j>1),
         NA(),
         JAI(
            JAG(
               SWITCH(JAL(exclude_types,include_types,replace_with),
                  0,x,
                  1,IF(
                     s,
                     JAC(exclude_types,include_types,replace_with,x,p),
                     JAF(w,exclude_types,include_types,replace_with,x,p))),
               v,
               o),
            if_empty
         )
      )
   )
)

XERROR.TYPE (posted separately)

XTYPE (posted separately)

JAB (returns a number greater than or equal to 1 (i.e. TRUE) if the reference has the specified data type(s) and 0 (i.e. FALSE) otherwise)
VBA Code:
=LAMBDA(types,advanced_types_array,
   IF(
      SUM(T1F0(ISERROR(MATCH(types,AllTypes,0)))),
      NA(),
      LET(
         basic_types_array,SWITCH(advanced_types_array,1,1,2,2,31,3,32,3,41,4,42,4,"","",16),
         MAP(advanced_types_array,LAMBDA(a,OR(a=types)))+MAP(basic_types_array,LAMBDA(a,OR(a=types)))
      )
   )
)

JAC (module for 1D [FILTER-based] "exclude_types/include_types/replace_with")
VBA Code:
=LAMBDA(exclude_types,include_types,replace_with,main_array,advanced_types_array,
   LET(
      d,IF(IO(include_types),exclude_types,include_types),
      x,JAB(d,advanced_types_array),
      IF(
         IO(replace_with),
         FILTER(
            main_array,
            IF(IO(include_types),NOT(x),x)),
         IF(
            IO(include_types),
            IF(x,replace_with,main_array),
            IF(x,main_array,replace_with)
         )
      )
   )
)

JAD [core for INDEX.Nth()]
VBA Code:
=LAMBDA(every,start_at,nth_elements,rows,output_style,
   IF(
      JAN(start_at),
      NA(),
      LET(
         o,LET(
            s,start_at,
            n,nth_elements,
            SWITCH(every,
               0,IF(
                  OR(output_style={0,1,2}),
                  LET(
                     m,n+(IF(IO(s),0,s-1)),
                     FILTER(
                        m,
                        (m>=IF(IO(s),0,s))*(m<=rows))),
                  NA()),
               1,LET(
               i,(s-IF(ISNUMBER(s),n,0))+n*SEQUENCE(ROUNDDOWN(IF(IO(s),rows/MIN(n),((rows-s)/MIN(n))+1),0)),
               j,IF(i>rows,"",i),
               SWITCH(output_style,
                  0,j,
                  1,LET(
                     u,TOCOL(j,,1),
                     FILTER(u,u<>"")),
                  2,LET(
                     v,TOCOL(j),
                     FILTER(v,v<>"")))))),
         IF(
            SUM(T1F0(ISERROR(o))),
            NA(),
            o
         )
      )
   )
)

JAE [INDEXer for JAD()]
VBA Code:
=LAMBDA(reference,core_output,
   IF(
      ISERROR(core_output),
      NA(),
      LET(
         r,IF(ISNUMBER(core_output),core_output,0),
         MAP(r,LAMBDA(r,IF(r,INDEX(reference,r),"")))
      )
   )
)

JAF (module for 2D "exclude_types/include_types/replace_with" when spill includes non-core blank cells)
VBA Code:
=LAMBDA(core_output,exclude_types,include_types,replace_with,main_array,advanced_types_array,
   LET(
      c,IF(IO(include_types),exclude_types,include_types),
      w,IF(ISNUMBER(core_output),1,0),
      x,JAB(c,advanced_types_array),
      m,IF(
         IO(include_types),
         IF(w*x,IF(IO(replace_with),"",replace_with),main_array),
         IF(w*x,main_array,IF(IO(replace_with),"",IF(w,replace_with,"")))),
      IF(
         IO(replace_with),
         JAH(core_output,x,m,include_types),
         m
      )
   )
)

JAG ["output_orientation" module for INDEX.Nth()]
VBA Code:
=LAMBDA(expression,hv,output_orientation,
   SWITCH(output_orientation,
      0,SWITCH(hv,0,TRANSPOSE(expression),expression),
      1,expression,
      2,TRANSPOSE(expression)
   )
)

JAH (removes rows and columns containing non-core blank cells)
VBA Code:
=LAMBDA(core_cells,treated_cells,treated_output,include_types,
   LET(
      c,core_cells,
      t,treated_cells,
      m,IF(ISNUMBER(c),1,0),
      d,IF(IF(IO(include_types),t*m,t),1,0),
      i,IF(IO(include_types),m-d,d),
      e,(IF(BYROW(i,LAMBDA(a,SUM(a))),1,0))*(SEQUENCE(ROWS(c))),
      o,FILTER(e,e),
      f,(IF(BYCOL(i,LAMBDA(a,SUM(a))),1,0))*(SEQUENCE(,COLUMNS(c))),
      p,FILTER(f,f),
      CHOOSECOLS(CHOOSEROWS(treated_output,o),p)
   )
)

JAI (module for "if_empty")
VBA Code:
=LAMBDA(operation,if_empty,
   IF(
      JAN(if_empty),
      NA(),
      LET(
         e,IF(ISERROR(operation),IF(ERROR.TYPE(operation)=14,1,0),0),
         f,IF(ISERROR(ROWS(operation)*COLUMNS(operation)),1,0),
         IF(
            e+f=2,
            IF(IO(if_empty),operation,if_empty),
            operation
         )
      )
   )
)

JAL (switch for "include_types/exclude_types")
VBA Code:
=LAMBDA(exclude_types,include_types,replace_with,
   IF(
      JAN(replace_with),
      NA(),
      IFS(
         AND(IO(exclude_types),IO(include_types),IO(replace_with)),0,
         OR(AND(IO(include_types),NIO(exclude_types)),AND(NIO(include_types),IO(exclude_types))),1
      )
   )
)

JAN [Returns TRUE if the reference is an array (i.e. is not a single element or is not omitted) and FALSE otherwise (simplified form of ISARRAY)]
VBA Code:
=LAMBDA([reference],
   LET(
      r,IFERROR(IF(reference="","",reference),""),
      IF(
         IO(reference),
         FALSE,
         IF(ROWS(r)*COLUMNS(r)>1,TRUE,FALSE)
      )
   )
)

JAO (Returns TRUE if the reference contains at least one error and FALSE otherwise [simplified form of ISERRORS])
VBA Code:
=LAMBDA(reference,
   IF(
      IO(reference),
      FALSE,
      IF(SUM(IF(ISERROR(reference),1,0)),TRUE,FALSE)
   )
)

JAP (Returns TRUE if the reference contains at least one blank and FALSE otherwise [simplified form of ISBLANKS])
VBA Code:
=LAMBDA(reference,
   IF(
      IO(reference),
      NA(),
      IF(SUM(IF(IFERROR(reference,0)="",1,0)),TRUE,FALSE)
   )
)

PLS (stands for "parameter limit, single")
(Returns the parameter if it is a single entry (not blank or error) and #N/A otherwise)
(Causes the function to crash to a single #N/A if the incorrect parameter is entered [either the wrong type or more than a single entry in array brackets "{}"])
VBA Code:
=LAMBDA(parameter,
   INDEX(
      IF(OR(JAN(parameter),JAO(parameter),JAP(parameter)),NA(),parameter),
      1
   )
)

PLSL (stands for "parameter limit, single logical)
(Returns 1 if the parameter is a single TRUE entry; 0 if the parameter is a single FALSE entry or is omitted; and #N/A otherwise)
(Causes the function to crash to a single #N/A if incorrect parameters are entered [either anything not capable of being evaluated logically or more than a single entry in array brackets "{}"]))
VBA Code:
=LAMBDA([parameter],
   IF(
      IO(parameter),
      0,
      IF(
         JAN(parameter),
         NA(),
         LET(
            p,INDEX(parameter,1),
            IF(ISERROR(p),NA(),T1F0(p))
         )
      )
   )
)

IO (shortened form of ISOMITTED)
VBA Code:
=LAMBDA(parameter,
   ISOMITTED(parameter)
)

NIO [shortened form of NOT(ISOMITTED)]
VBA Code:
=LAMBDA(parameter,
   NOT(ISOMITTED(parameter))
)

OF (Returns "FALSE" if the reference is TRUE, "0" if the reference is FALSE, and #N/A otherwise)
VBA Code:
=LAMBDA(reference,
   IF(
      ISERROR(IF(reference="",NA(),reference)),
      NA(),
      IFERROR(IF(reference,0,FALSE),NA())
   )
)

OT (Returns "TRUE" if the reference is TRUE, "1" if the reference is FALSE, and #N/A otherwise)
VBA Code:
=LAMBDA(reference,
   IF(
      ISERROR(IF(reference="",NA(),reference)),
      NA(),
      IFERROR(IF(reference,1,TRUE),NA())
   )
)

PO0 (Returns 0 if the parameter is omitted and the parameter itself otherwise)
VBA Code:
=LAMBDA([parameter],
   IF(IO(parameter),0,parameter)
)

T1F0 (Returns 1 if the reference is TRUE, 0 if the reference is FALSE, and #N/A otherwise)
VBA Code:
=LAMBDA(expression,
   IF(
      ISNUMBER(expression)+ISLOGICAL(expression),
      IF(expression,1,0),
      NA()
   )
)

Here are all the modules in the XL2BB format (note that these are the most up-to-date versions compared with the same modules from my previous posts for other functions):
INDEX.Nth.xlsx
ABCD
1
2INDEX.Nth#CALC!
3IO#CALC!
4JAB#CALC!
5JAC#CALC!
6JAD#CALC!
7JAE#CALC!
8JAF#CALC!
9JAG#CALC!
10JAH#CALC!
11JAI#CALC!
12JAL#CALC!
13JAN#CALC!
14JAO#CALC!
15JAP#CALC!
16NIO#CALC!
17OF#CALC!
18OT#CALC!
19PLS#CALC!
20PLSL#CALC!
21PO0#CALC!
22T1F0#CALC!
23XERROR.TYPE#CALC!
24XTYPE#CALC!
25
Sheet2
Cell Formulas
RangeFormula
C2C2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
C3C3=LAMBDA(parameter,ISOMITTED(parameter))
C4C4=LAMBDA(types,advanced_types_array,IF(SUM(T1F0(ISERROR(MATCH(types,AllTypes,0)))),NA(),LET(basic_types_array,SWITCH(advanced_types_array,1,1,2,2,31,3,32,3,41,4,42,4,"","",16),MAP(advanced_types_array,LAMBDA(a,OR(a=types)))+MAP(basic_types_array,LAMBDA(a,OR(a=types))))))
C5C5=LAMBDA(exclude_types,include_types,replace_with,main_array,advanced_types_array,LET(d,IF(IO(include_types),exclude_types,include_types),x,JAB(d,advanced_types_array),IF(IO(replace_with),FILTER(main_array,IF(IO(include_types),NOT(x),x)),IF(IO(include_types),IF(x,replace_with,main_array),IF(x,main_array,replace_with)))))
C6C6=LAMBDA(every,start_at,nth_elements,rows,output_style,IF(JAN(start_at),NA(),LET(o,LET(s,start_at,n,nth_elements,SWITCH(every,0,IF(OR(output_style={0,1,2}),LET(m,n+(IF(IO(s),0,s-1)),FILTER(m,(m>=IF(IO(s),0,s))*(m<=rows))),NA()),1,LET(i,(s-IF(ISNUMBER(s),n,0))+n*SEQUENCE(ROUNDDOWN(IF(IO(s),rows/MIN(n),((rows-s)/MIN(n))+1),0)),j,IF(i>rows,"",i),SWITCH(output_style,0,j,1,LET(u,TOCOL(j,,1),FILTER(u,u<>"")),2,LET(v,TOCOL(j),FILTER(v,v<>"")))))),IF(SUM(T1F0(ISERROR(o))),NA(),o))))
C7C7=LAMBDA(reference,core_output,IF(ISERROR(core_output),NA(),LET(r,IF(ISNUMBER(core_output),core_output,0),MAP(r,LAMBDA(r,IF(r,INDEX(reference,r),""))))))
C8C8=LAMBDA(core_output,exclude_types,include_types,replace_with,main_array,advanced_types_array,LET(c,IF(IO(include_types),exclude_types,include_types),w,IF(ISNUMBER(core_output),1,0),x,JAB(c,advanced_types_array),m,IF(IO(include_types),IF(w*x,IF(IO(replace_with),"",replace_with),main_array),IF(w*x,main_array,IF(IO(replace_with),"",IF(w,replace_with,"")))),IF(IO(replace_with),JAH(core_output,x,m,include_types),m)))
C9C9=LAMBDA(expression,hv,output_orientation,SWITCH(output_orientation,0,SWITCH(hv,0,TRANSPOSE(expression),expression),1,expression,2,TRANSPOSE(expression)))
C10C10=LAMBDA(core_cells,treated_cells,treated_output,include_types,LET(c,core_cells,t,treated_cells,m,IF(ISNUMBER(c),1,0),d,IF(IF(IO(include_types),t*m,t),1,0),i,IF(IO(include_types),m-d,d),e,(IF(BYROW(i,LAMBDA(a,SUM(a))),1,0))*(SEQUENCE(ROWS(c))),o,FILTER(e,e),f,(IF(BYCOL(i,LAMBDA(a,SUM(a))),1,0))*(SEQUENCE(,COLUMNS(c))),p,FILTER(f,f),CHOOSECOLS(CHOOSEROWS(treated_output,o),p)))
C11C11=LAMBDA(operation,if_empty,IF(JAN(if_empty),NA(),LET(e,IF(ISERROR(operation),IF(ERROR.TYPE(operation)=14,1,0),0),f,IF(ISERROR(ROWS(operation)*COLUMNS(operation)),1,0),IF(e+f=2,IF(IO(if_empty),operation,if_empty),operation))))
C12C12=LAMBDA(exclude_types,include_types,replace_with,IF(JAN(replace_with),NA(),IFS(AND(IO(exclude_types),IO(include_types),IO(replace_with)),0,OR(AND(IO(include_types),NIO(exclude_types)),AND(NIO(include_types),IO(exclude_types))),1)))
C13C13=LAMBDA([reference],LET(r,IFERROR(IF(reference="","",reference),""),IF(IO(reference),FALSE,IF(ROWS(r)*COLUMNS(r)>1,TRUE,FALSE))))
C14C14=LAMBDA(reference,IF(IO(reference),FALSE,IF(SUM(IF(ISERROR(reference),1,0)),TRUE,FALSE)))
C15C15=LAMBDA(reference,IF(IO(reference),NA(),IF(SUM(IF(IFERROR(reference,0)="",1,0)),TRUE,FALSE)))
C16C16=LAMBDA(parameter,NOT(ISOMITTED(parameter)))
C17C17=LAMBDA(reference,IF(ISERROR(IF(reference="",NA(),reference)),NA(),IFERROR(IF(reference,0,FALSE),NA())))
C18C18=LAMBDA(reference,IF(ISERROR(IF(reference="",NA(),reference)),NA(),IFERROR(IF(reference,1,TRUE),NA())))
C19C19=LAMBDA(parameter,INDEX(IF(OR(JAN(parameter),JAO(parameter),JAP(parameter)),NA(),parameter),1))
C20C20=LAMBDA([parameter],IF(IO(parameter),0,IF(JAN(parameter),NA(),LET(p,INDEX(parameter,1),IF(ISERROR(p),NA(),T1F0(p))))))
C21C21=LAMBDA([parameter],IF(IO(parameter),0,parameter))
C22C22=LAMBDA(expression,IF(ISNUMBER(expression)+ISLOGICAL(expression),IF(expression,1,0),NA()))
C23C23=LAMBDA(reference,[analysis_type],[if_not_error],IF(IO(reference),NA(),LET(a,PLS(PO0(analysis_type)),o,SWITCH(a,0,SWITCH(ERROR.TYPE(reference),0,160,1,161,2,162,3,163,4,164,5,165,6,166,7,167,8,168,9,169,10,1610,11,1611,12,1612,13,1613,14,1614),1,SWITCH(ERROR.TYPE(reference),0,"dt:ERROR_EXTERNAL!",1,"dt:ERROR_NULL!",2,"dt:ERROR_DIV/0!",3,"dt:ERROR_VALUE!",4,"dt:ERROR_REF!",5,"dt:ERROR_NAME?",6,"dt:ERROR_NUM!",7,"dt:ERROR_N/A",8,"dt:ERROR_GETTING_Data",9,"dt:ERROR_SPILL!",10,"dt:ERROR_CONNECT!",11,"dt:ERROR_BLOCKED!",12,"dt:ERROR_UNKNOWN!",13,"dt:ERROR_FIELD!",14,"dt:ERROR_CALC!"),2,ERROR.TYPE(reference)),IF(ISERROR(a),o,IF(JAN(if_not_error),NA(),IF(IO(if_not_error),o,IF(ISERROR(o),if_not_error,o)))))))
C24C24=LAMBDA(reference,[analysis_type],IF(IO(reference),NA(),LET(r,reference,a,PLS(PO0(analysis_type)),IF(OR(a={0,1,2,3}),LET(z,MAP(r,LAMBDA(b,IF(ISERROR(b),XERROR.TYPE(b),IF(b="",IF(ISBLANK(b),31,32),IF(ISNUMBER(b),1,IF(ISTEXT(b),2,IF(b,41,42))))))),SWITCH(a,0,SWITCH(z,1,"dt:NUMBER",2,"dt:TEXT",31,"dt:BLANK",32,"dt:BLANK",41,"dt:LOGICAL",42,"dt:LOGICAL","dt:ERROR"),1,SWITCH(z,1,"dt:NUMBER",2,"dt:TEXT",31,"dt:BLANK_REAL",32,"dt:BLANK_FORMULA",41,"dt:LOGICAL_TRUE",42,"dt:LOGICAL_FALSE",160,"dt:ERROR_EXTERNAL!",161,"dt:ERROR_NULL!",162,"dt:ERROR_DIV/0!",163,"dt:ERROR_VALUE!",164,"dt:ERROR_REF!",165,"dt:ERROR_NAME?",166,"dt:ERROR_NUM!",167,"dt:ERROR_N/A",168,"dt:ERROR_GETTING_Data",169,"dt:ERROR_SPILL!",1610,"dt:ERROR_CONNECT!",1611,"dt:ERROR_BLOCKED!",1612,"dt:ERROR_UNKNOWN!",1613,"dt:ERROR_FIELD!",1614,"dt:ERROR_CALC!"),2,SWITCH(z,1,1,2,2,31,3,32,3,41,4,42,4,16),3,z)),LET(t,MAP(r,LAMBDA(u,IF(OR(a={4,5}),TYPE(u),CELL("type",u)))),SWITCH(a,4,t,5,SWITCH(t,1,"dt:NUMBER",2,"dt:TEXT",4,"dt:LOGICAL",16,"dt:ERROR"),6,t))))))
 
Upvote 0
General demo:
INDEX.Nth.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1
2#CALC!basic typesadvanced types
31dt:NUMBER1dt:NUMBER
443book46.8920TRUE2dt:TEXT2dt:TEXT
5#CALC!0notebook283dt:BLANK31dt:BLANK_REAL
61423#DIV/0!24 4dt:LOGICAL32dt:BLANK_FORMULA
764FALSE56notebook3716dt:ERROR41dt:LOGICAL_TRUE
842dt:LOGICAL_FALSE
9160dt:ERROR_EXTERNAL!
10nth_elementseverystart_atoutput161dt:ERROR_NULL!
111omittedomitted43162dt:ERROR_DIV/0!
122omittedomittedbook163dt:ERROR_VALUE!
133omittedomitted46.89164dt:ERROR_REF!
144omittedomitted20165dt:ERROR_NAME?
155omittedomittedTRUE166dt:ERROR_NUM!
166omittedomitted#N/A167dt:ERROR_N/A!
17{1,2}omittedomitted43book168dt:ERROR_GETTING_DATA!
18{1,3}omittedomitted4346.89169dt:ERROR_SPILL!
19{1,4}omittedomitted43201610dt:ERROR_CONNECT!
20{1,5}omittedomitted43TRUE1611dt:ERROR_BLOCKED!
21{1,6}omittedomitted431612dt:ERROR_UNKNOWN!
22{2,3}omittedomittedbook46.891613dt:ERROR_FIELD!
23{2,4}omittedomittedbook201614dt:ERROR_CALC!
24{2,5}omittedomittedbookTRUE
25{2,6}omittedomittedbook
26{3,4}omittedomitted46.8920
27{3,5}omittedomitted46.89TRUE
28{3,6}omittedomitted46.89
29{4,5}omittedomitted20TRUE
30{4,6}omittedomitted20
31{5,6}omittedomittedTRUE
32{3,3}omittedomitted46.8946.89
33{1,3,4,2}omittedomitted4346.8920book
34{1,3,3,3,4,2,1,5}omittedomitted4346.8946.8946.8920book43TRUE
351omitted143
362omitted246.89
373omitted3TRUE
384omitted4#N/A
395omitted5#N/A
406omitted6#N/A
41{1,2}omitted143book
42{1,3}omitted2book20
43{1,4}omitted346.89
44{1,5}omitted420
45{1,6}omitted5TRUE
46{2,3}omitted6#N/A
47{2,4}omitted1book20
48{2,5}omitted246.89
49{2,6}omitted320
50{3,4}omitted4#N/A
51{3,5}omitted5#N/A
52{3,6}omitted6#N/A
53{3,3}omitted146.8946.89
54{1,3,4,2}omitted2book20TRUE46.89
55{1,3,3,3,4,2,1,5}omitted346.89TRUETRUETRUE2046.89
56
57
58nth_elementseveryoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput
5911omittedomitted43omitted14311432143book46.8920TRUE
60bookbookbook21book20
6146.8946.8946.892146.89
622020202120
63TRUETRUETRUE21TRUE
6421omittedomittedbookomitted1book11book21#N/A
65202020
6631omittedomitted46.89omitted146.891146.89
6741omittedomitted20omitted1201120
6851omittedomittedTRUEomitted1TRUE11TRUE
6961omittedomitted#N/Aomitted1#N/A11#N/A
70
71output_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput
72omitted24312432243book46.8920TRUE
73bookbook22book20
7446.8946.892246.89
7520202220
76TRUETRUE22TRUE
77omitted2book12book22#N/A
782020
79omitted246.891246.89
80omitted2201220
81omitted2TRUE12TRUE
82omitted2#N/A12#N/A
83
84
85nth_elementseveryoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput
8611omittedomitted43#CALC!1464omitted143#CALC!146411432143#CALC!1464
8721omittedomitted#CALC!64omitted1#CALC!64#CALC!21#CALC!64
8831omittedomitted14omitted114142114
8941omittedomitted64omitted164642164
9051omittedomitted#N/Aomitted1#N/A11#CALC!21#N/A
9164
921114
931164
9411#N/A
95
96output_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput
97omitted243#CALC!146412432243#CALC!1464
98omitted2#CALC!64#CALC!22#CALC!64
99omitted214142214
100omitted264642264
101omitted2#N/A12#CALC!22#N/A
10264
1031214
1041264
10512#N/A
106
general
Cell Formulas
RangeFormula
B2B2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
B5B5=XERROR(14)
D6D6=1/0
F6F6=IF(1,"")
E11E11=INDEX.Nth($B$4:$F$4,1)
E12E12=INDEX.Nth($B$4:$F$4,2)
E13E13=INDEX.Nth($B$4:$F$4,3)
E14E14=INDEX.Nth($B$4:$F$4,4)
E15E15=INDEX.Nth($B$4:$F$4,5)
E16E16=INDEX.Nth($B$4:$F$4,6)
E17:F17E17=INDEX.Nth($B$4:$F$4,{1,2})
E18:F18E18=INDEX.Nth($B$4:$F$4,{1,3})
E19:F19E19=INDEX.Nth($B$4:$F$4,{1,4})
E20:F20E20=INDEX.Nth($B$4:$F$4,{1,5})
E21E21=INDEX.Nth($B$4:$F$4,{1,6})
E22:F22E22=INDEX.Nth($B$4:$F$4,{2,3})
E23:F23E23=INDEX.Nth($B$4:$F$4,{2,4})
E24:F24E24=INDEX.Nth($B$4:$F$4,{2,5})
E25E25=INDEX.Nth($B$4:$F$4,{2,6})
E26:F26E26=INDEX.Nth($B$4:$F$4,{3,4})
E27:F27E27=INDEX.Nth($B$4:$F$4,{3,5})
E28E28=INDEX.Nth($B$4:$F$4,{3,6})
E29:F29E29=INDEX.Nth($B$4:$F$4,{4,5})
E30E30=INDEX.Nth($B$4:$F$4,{4,6})
E31E31=INDEX.Nth($B$4:$F$4,{5,6})
E32:F32E32=INDEX.Nth($B$4:$F$4,{3,3})
E33:H33E33=INDEX.Nth($B$4:$F$4,{1,3,4,2})
E34:L34E34=INDEX.Nth($B$4:$F$4,{1,3,3,3,4,2,1,5})
E35E35=INDEX.Nth($B$4:$F$4,1,,1)
E36E36=INDEX.Nth($B$4:$F$4,2,,2)
E37E37=INDEX.Nth($B$4:$F$4,3,,3)
E38E38=INDEX.Nth($B$4:$F$4,4,,4)
E39E39=INDEX.Nth($B$4:$F$4,5,,5)
E40E40=INDEX.Nth($B$4:$F$4,6,,6)
E41:F41E41=INDEX.Nth($B$4:$F$4,{1,2},,1)
E42:F42E42=INDEX.Nth($B$4:$F$4,{1,3},,2)
E43E43=INDEX.Nth($B$4:$F$4,{1,4},,3)
E44E44=INDEX.Nth($B$4:$F$4,{1,5},,4)
E45E45=INDEX.Nth($B$4:$F$4,{1,6},,5)
E46E46=INDEX.Nth($B$4:$F$4,{2,3},,6)
E47:F47E47=INDEX.Nth($B$4:$F$4,{2,4},,1)
E48E48=INDEX.Nth($B$4:$F$4,{2,5},,2)
E49E49=INDEX.Nth($B$4:$F$4,{2,6},,3)
E50E50=INDEX.Nth($B$4:$F$4,{3,4},,4)
E51E51=INDEX.Nth($B$4:$F$4,{3,5},,5)
E52E52=INDEX.Nth($B$4:$F$4,{3,6},,6)
E53:F53E53=INDEX.Nth($B$4:$F$4,{3,3},,1)
E54:H54E54=INDEX.Nth($B$4:$F$4,{1,3,4,2},,2)
E55:J55E55=INDEX.Nth($B$4:$F$4,{1,3,3,3,4,2,1,5},,3)
F59:F63F59=INDEX.Nth($B$4:$F$4,1,1,,)
J59:J63,N59:N63J59=INDEX.Nth($B$4:$F$4,1,1,,,1)
F64:F65F64=INDEX.Nth($B$4:$F$4,2,1,,)
J64:J65,N64:N65J64=INDEX.Nth($B$4:$F$4,2,1,,,1)
R59:V59R59=INDEX.Nth($B$4:$F$4,1,1,,2,1)
R60:S60R60=INDEX.Nth($B$4:$F$4,2,1,,2,1)
R61R61=INDEX.Nth($B$4:$F$4,3,1,,2,1)
R62R62=INDEX.Nth($B$4:$F$4,4,1,,2,1)
R63R63=INDEX.Nth($B$4:$F$4,5,1,,2,1)
R64R64=INDEX.Nth($B$4:$F$4,6,1,,2,1)
F66F66=INDEX.Nth($B$4:$F$4,3,1,,)
F67F67=INDEX.Nth($B$4:$F$4,4,1,,)
F68F68=INDEX.Nth($B$4:$F$4,5,1,,)
F69F69=INDEX.Nth($B$4:$F$4,6,1,,)
J66,N66J66=INDEX.Nth($B$4:$F$4,3,1,,,1)
J67,N67J67=INDEX.Nth($B$4:$F$4,4,1,,,1)
J68,N68J68=INDEX.Nth($B$4:$F$4,5,1,,,1)
J69,N69J69=INDEX.Nth($B$4:$F$4,6,1,,,1)
J72:J76,N72:N76J72=INDEX.Nth($B$4:$F$4,1,1,,,2)
J77:J78,N77:N78J77=INDEX.Nth($B$4:$F$4,2,1,,,2)
R72:V72R72=INDEX.Nth($B$4:$F$4,1,1,,2,2)
R73:S73R73=INDEX.Nth($B$4:$F$4,2,1,,2,2)
R74R74=INDEX.Nth($B$4:$F$4,3,1,,2,2)
R75R75=INDEX.Nth($B$4:$F$4,4,1,,2,2)
R76R76=INDEX.Nth($B$4:$F$4,5,1,,2,2)
R77R77=INDEX.Nth($B$4:$F$4,6,1,,2,2)
J79,N79J79=INDEX.Nth($B$4:$F$4,3,1,,,2)
J80,N80J80=INDEX.Nth($B$4:$F$4,4,1,,,2)
J81,N81J81=INDEX.Nth($B$4:$F$4,5,1,,,2)
J82,N82J82=INDEX.Nth($B$4:$F$4,6,1,,,2)
T86:T89T86=INDEX.Nth($B$4:$B$7,1,1,,1,1)
F86:I86F86=INDEX.Nth($B$4:$B$7,1,1,,)
F87:G87F87=INDEX.Nth($B$4:$B$7,2,1,,)
F88F88=INDEX.Nth($B$4:$B$7,3,1,,)
F89F89=INDEX.Nth($B$4:$B$7,4,1,,)
F90F90=INDEX.Nth($B$4:$B$7,5,1,,)
M86:P86M86=INDEX.Nth($B$4:$B$7,1,1,,,1)
M87:N87M87=INDEX.Nth($B$4:$B$7,2,1,,,1)
M88,T92M88=INDEX.Nth($B$4:$B$7,3,1,,,1)
M89,T93M89=INDEX.Nth($B$4:$B$7,4,1,,,1)
M90,T94M90=INDEX.Nth($B$4:$B$7,5,1,,,1)
T90:T91T90=INDEX.Nth($B$4:$B$7,2,1,,1,1)
X86:AA86X86=INDEX.Nth($B$4:$B$7,1,1,,2,1)
X87:Y87X87=INDEX.Nth($B$4:$B$7,2,1,,2,1)
X88X88=INDEX.Nth($B$4:$B$7,3,1,,2,1)
X89X89=INDEX.Nth($B$4:$B$7,4,1,,2,1)
X90X90=INDEX.Nth($B$4:$B$7,5,1,,2,1)
T97:T100T97=INDEX.Nth($B$4:$B$7,1,1,,1,2)
M97:P97M97=INDEX.Nth($B$4:$B$7,1,1,,,2)
M98:N98M98=INDEX.Nth($B$4:$B$7,2,1,,,2)
M99,T103M99=INDEX.Nth($B$4:$B$7,3,1,,,2)
M100,T104M100=INDEX.Nth($B$4:$B$7,4,1,,,2)
M101,T105M101=INDEX.Nth($B$4:$B$7,5,1,,,2)
T101:T102T101=INDEX.Nth($B$4:$B$7,2,1,,1,2)
X97:AA97X97=INDEX.Nth($B$4:$B$7,1,1,,2,2)
X98:Y98X98=INDEX.Nth($B$4:$B$7,2,1,,2,2)
X99X99=INDEX.Nth($B$4:$B$7,3,1,,2,2)
X100X100=INDEX.Nth($B$4:$B$7,4,1,,2,2)
X101X101=INDEX.Nth($B$4:$B$7,5,1,,2,2)
Dynamic array formulas.
 
output_style demos:
1.
INDEX.Nth.xlsx
ABCDEFGHIJKLMNOPQRSTUVWX
1
2#CALC!basic typesadvanced types
31dt:NUMBER1dt:NUMBER
443book46.8920TRUE2dt:TEXT2dt:TEXT
5#CALC!0notebook283dt:BLANK31dt:BLANK_REAL
61423#DIV/0!24 4dt:LOGICAL32dt:BLANK_FORMULA
764FALSE56notebook3716dt:ERROR41dt:LOGICAL_TRUE
842dt:LOGICAL_FALSE
9160dt:ERROR_EXTERNAL!
10nth_elementseveryoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput161dt:ERROR_NULL!
11{1,2}1omittedomitted43book1omitted43book2omitted43book46.8920TRUE162dt:ERROR_DIV/0!
12book20book20book20163dt:ERROR_VALUE!
1346.8946.892omitted43book46.8920TRUE164dt:ERROR_REF!
14202046.89165dt:ERROR_NAME?
15TRUETRUE2omitted43book46.8920TRUE166dt:ERROR_NUM!
16{1,3}1omittedomitted4346.891omitted4346.8920167dt:ERROR_N/A!
17bookbook2omitted43book46.8920TRUE168dt:ERROR_GETTING_DATA!
1846.8946.89TRUE169dt:ERROR_SPILL!
1920202omitted43book46.8920TRUE1610dt:ERROR_CONNECT!
20TRUETRUE1611dt:ERROR_BLOCKED!
21{1,4}1omittedomitted43201omitted43201612dt:ERROR_UNKNOWN!
22bookbook1613dt:ERROR_FIELD!
2346.8946.891614dt:ERROR_CALC!
242020
25TRUETRUE
26{1,5}1omittedomitted43TRUE1omitted43TRUE
27bookbook
2846.8946.89
292020
30TRUETRUE
31{1,6}1omittedomitted431omitted43
32bookbook
3346.8946.89
342020
35TRUETRUE
36
37
38nth_elementseveryoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput
39{1,2}1omitted14311432143book46.8920TRUEbook20
40bookbook2143book46.8920TRUE46.89
4146.8946.892143book46.8920TRUE20
4220202143book46.8920TRUETRUE
43TRUETRUE2143book46.8920TRUE
44bookbook
452020
46{1,3}1omitted1431143
47bookbook
4846.8946.89
492020
50TRUETRUE
5146.8946.89
52{1,4}1omitted1431143
53bookbook
5446.8946.89
552020
56TRUETRUE
572020
58{1,5}1omitted1431143
59bookbook
6046.8946.89
612020
62TRUETRUE
63TRUETRUE
64{1,6}1omitted1431143
65bookbook
6646.8946.89
672020
68TRUETRUE
69
70
71nth_elementseveryoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput
72{1,2}1omitted24312432243bookbook2046.8920TRUE
73bookbook224346.89book46.8920TRUE
74bookbook224320book46.8920TRUE
7520202243TRUEbook46.8920TRUE
7646.8946.892243book46.8920TRUE
772020
78TRUETRUE
79{1,3}1omitted2431243
8046.8946.89
81bookbook
8246.8946.89
832020
84TRUETRUE
85{1,4}1omitted2431243
862020
87bookbook
8846.8946.89
892020
90TRUETRUE
91{1,5}1omitted2431243
92TRUETRUE
93bookbook
9446.8946.89
952020
96TRUETRUE
97{1,6}1omitted2431243
98bookbook
9946.8946.89
1002020
101TRUETRUE
102
os-h
Cell Formulas
RangeFormula
B2B2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
D6D6=1/0
F6F6=IF(1,"")
F11:G15F11=INDEX.Nth($B$4:$F$4,{1,2},1)
K11:L15K11=INDEX.Nth($B$4:$F$4,{1,2},1,,1)
P11:T12P11=INDEX.Nth($B$4:$F$4,{1,2},1,,2)
P13:T14P13=INDEX.Nth($B$4:$F$4,{1,3},1,,2)
P15:T16P15=INDEX.Nth($B$4:$F$4,{1,4},1,,2)
F16:G20F16=INDEX.Nth($B$4:$F$4,{1,3},1)
K16:L20K16=INDEX.Nth($B$4:$F$4,{1,3},1,,1)
P17:T18P17=INDEX.Nth($B$4:$F$4,{1,5},1,,2)
P19:T19P19=INDEX.Nth($B$4:$F$4,{1,6},1,,2)
F21:G25F21=INDEX.Nth($B$4:$F$4,{1,4},1)
K21:L25K21=INDEX.Nth($B$4:$F$4,{1,4},1,,1)
F26:G30F26=INDEX.Nth($B$4:$F$4,{1,5},1)
K26:L30K26=INDEX.Nth($B$4:$F$4,{1,5},1,,1)
F31:F35F31=INDEX.Nth($B$4:$F$4,{1,6},1)
K31:K35K31=INDEX.Nth($B$4:$F$4,{1,6},1,,1)
F39:F45F39=INDEX.Nth($B$4:$F$4,{1,2},1,,0,1)
J39:J45J39=INDEX.Nth($B$4:$F$4,{1,2},1,,1,1)
N39:T39N39=INDEX.Nth($B$4:$F$4,{1,2},1,,2,1)
N40:S40N40=INDEX.Nth($B$4:$F$4,{1,3},1,,2,1)
N41:S41N41=INDEX.Nth($B$4:$F$4,{1,4},1,,2,1)
N42:S42N42=INDEX.Nth($B$4:$F$4,{1,5},1,,2,1)
N43:R43N43=INDEX.Nth($B$4:$F$4,{1,6},1,,2,1)
F46:F51F46=INDEX.Nth($B$4:$F$4,{1,3},1,,,1)
J46:J51J46=INDEX.Nth($B$4:$F$4,{1,3},1,,1,1)
F52:F57F52=INDEX.Nth($B$4:$F$4,{1,4},1,,,1)
J52:J57J52=INDEX.Nth($B$4:$F$4,{1,4},1,,1,1)
F58:F63F58=INDEX.Nth($B$4:$F$4,{1,5},1,,,1)
J58:J63J58=INDEX.Nth($B$4:$F$4,{1,5},1,,1,1)
F64:F68F64=INDEX.Nth($B$4:$F$4,{1,6},1,,,1)
J64:J68J64=INDEX.Nth($B$4:$F$4,{1,6},1,,1,1)
F72:F78F72=INDEX.Nth($B$4:$F$4,{1,2},1,,,2)
J72:J78J72=INDEX.Nth($B$4:$F$4,{1,2},1,,1,2)
N72:T72N72=INDEX.Nth($B$4:$F$4,{1,2},1,,2,2)
N73:S73N73=INDEX.Nth($B$4:$F$4,{1,3},1,,2,2)
N74:S74N74=INDEX.Nth($B$4:$F$4,{1,4},1,,2,2)
N75:S75N75=INDEX.Nth($B$4:$F$4,{1,5},1,,2,2)
N76:R76N76=INDEX.Nth($B$4:$F$4,{1,6},1,,2,2)
F79:F84F79=INDEX.Nth($B$4:$F$4,{1,3},1,,,2)
J79:J84J79=INDEX.Nth($B$4:$F$4,{1,3},1,,1,2)
F85:F90F85=INDEX.Nth($B$4:$F$4,{1,4},1,,,2)
J85:J90J85=INDEX.Nth($B$4:$F$4,{1,4},1,,1,2)
F91:F96F91=INDEX.Nth($B$4:$F$4,{1,5},1,,,2)
J91:J96J91=INDEX.Nth($B$4:$F$4,{1,5},1,,1,2)
F97:F101F97=INDEX.Nth($B$4:$F$4,{1,6},1,,,2)
J97:J101J97=INDEX.Nth($B$4:$F$4,{1,6},1,,1,2)
Dynamic array formulas.



2.
INDEX.Nth.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXY
1
2#CALC!basic typesadvanced types
31dt:NUMBER1dt:NUMBER
443book46.8920TRUE2dt:TEXT2dt:TEXT
5#CALC!0notebook283dt:BLANK31dt:BLANK_REAL
61423#DIV/0!24 4dt:LOGICAL32dt:BLANK_FORMULA
764FALSE56notebook3716dt:ERROR41dt:LOGICAL_TRUE
842dt:LOGICAL_FALSE
9160dt:ERROR_EXTERNAL!
10nth_elementseveryoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput161dt:ERROR_NULL!
11{1,2}1omittedomitted43#CALC!14641omitted43#CALC!2omitted43#CALC!1464162dt:ERROR_DIV/0!
12#CALC!64#CALC!64#CALC!64163dt:ERROR_VALUE!
13{1,3}1omittedomitted43#CALC!1464142omitted43#CALC!1464164dt:ERROR_REF!
14146414165dt:ERROR_NAME?
15{1,4}1omittedomitted43#CALC!14641omitted43142omitted43#CALC!1464166dt:ERROR_NUM!
1664#CALC!64167dt:ERROR_N/A!
17{1,5}1omittedomitted43#CALC!1464142omitted43#CALC!1464168dt:ERROR_GETTING_DATA!
1864169dt:ERROR_SPILL!
191omitted43641610dt:ERROR_CONNECT!
20#CALC!1611dt:ERROR_BLOCKED!
21141612dt:ERROR_UNKNOWN!
22641613dt:ERROR_FIELD!
231omitted431614dt:ERROR_CALC!
24#CALC!
2514
2664
27
28
29nth_elementseveryoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput
30{1,2}1omitted143#CALC!1464#CALC!641143omitted143#CALC!1464#CALC!64
31{1,3}1omitted143#CALC!146414#CALC!omitted143#CALC!146414
32{1,4}1omitted143#CALC!14646414omitted143#CALC!146464
33{1,5}1omitted143#CALC!146464omitted143#CALC!1464
34#CALC!
3564
361143
37#CALC!
3814
3964
4014
411143
42#CALC!
4314
4464
4564
461143
47#CALC!
4814
4964
50
51
52nth_elementseveryoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutputoutput_orientationoutput_styleoutput
53{1,2}1omitted243#CALC!#CALC!6414641243omitted243#CALC!#CALC!641464
54{1,3}1omitted24314#CALC!1464#CALC!omitted24314#CALC!1464
55{1,4}1omitted24364#CALC!1464#CALC!omitted24364#CALC!1464
56{1,5}1omitted243#CALC!146464omitted243#CALC!1464
5714
5864
591243
6014
61#CALC!
6214
6364
641243
6564
66#CALC!
6714
6864
691243
70#CALC!
7114
7264
73
os-v
Cell Formulas
RangeFormula
B2B2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
D6D6=1/0
F6F6=IF(1,"")
F11:I12F11=INDEX.Nth($B$4:$B$7,{1,2},1)
M11:N14M11=INDEX.Nth($B$4:$B$7,{1,2},1,,1)
R11:U12R11=INDEX.Nth($B$4:$B$7,{1,2},1,,2)
F13:I14F13=INDEX.Nth($B$4:$B$7,{1,3},1)
R13:U14R13=INDEX.Nth($B$4:$B$7,{1,3},1,,2)
F15:I16F15=INDEX.Nth($B$4:$B$7,{1,4},1)
M15:N18M15=INDEX.Nth($B$4:$B$7,{1,3},1,,1)
R15:U16R15=INDEX.Nth($B$4:$B$7,{1,4},1,,2)
F17:I17F17=INDEX.Nth($B$4:$B$7,{1,5},1)
R17:U17R17=INDEX.Nth($B$4:$B$7,{1,5},1,,2)
M19:N22M19=INDEX.Nth($B$4:$B$7,{1,4},1,,1)
M23:M26M23=INDEX.Nth($B$4:$B$7,{1,5},1,,1)
O30:O35O30=INDEX.Nth($B$4:$B$7,{1,2},1,,1,1)
F30:K30F30=INDEX.Nth($B$4:$B$7,{1,2},1,,,1)
F31:J31F31=INDEX.Nth($B$4:$B$7,{1,3},1,,,1)
F32:J32F32=INDEX.Nth($B$4:$B$7,{1,4},1,,,1)
F33:I33F33=INDEX.Nth($B$4:$B$7,{1,5},1,,,1)
S30:X30S30=INDEX.Nth($B$4:$B$7,{1,2},1,,2,1)
S31:W31S31=INDEX.Nth($B$4:$B$7,{1,3},1,,2,1)
S32:W32S32=INDEX.Nth($B$4:$B$7,{1,4},1,,2,1)
S33:V33S33=INDEX.Nth($B$4:$B$7,{1,5},1,,2,1)
O36:O40O36=INDEX.Nth($B$4:$B$7,{1,3},1,,1,1)
O41:O45O41=INDEX.Nth($B$4:$B$7,{1,4},1,,1,1)
O46:O49O46=INDEX.Nth($B$4:$B$7,{1,5},1,,1,1)
O53:O58O53=INDEX.Nth($B$4:$B$7,{1,2},1,,1,2)
F53:K53F53=INDEX.Nth($B$4:$B$7,{1,2},1,,,2)
F54:J54F54=INDEX.Nth($B$4:$B$7,{1,3},1,,,2)
F55:J55F55=INDEX.Nth($B$4:$B$7,{1,4},1,,,2)
F56:I56F56=INDEX.Nth($B$4:$B$7,{1,5},1,,,2)
S53:X53S53=INDEX.Nth($B$4:$B$7,{1,2},1,,2,2)
S54:W54S54=INDEX.Nth($B$4:$B$7,{1,3},1,,2,2)
S55:W55S55=INDEX.Nth($B$4:$B$7,{1,4},1,,2,2)
S56:V56S56=INDEX.Nth($B$4:$B$7,{1,5},1,,2,2)
O59:O63O59=INDEX.Nth($B$4:$B$7,{1,3},1,,1,2)
O64:O68O64=INDEX.Nth($B$4:$B$7,{1,4},1,,1,2)
O69:O72O69=INDEX.Nth($B$4:$B$7,{1,5},1,,1,2)
Dynamic array formulas.
 
Additional output_style (along with output_orientation) demo:
INDEX.Nth.xlsx
ABCDEFGHIJKLMNOPQRST
1
2#CALC!
3
443book46.89TRUE#CALC! FALSE
5#CALC!0notebook28FALSE#DIV/0!23
61423#DIV/0!24 12orangeb
764FALSE56notebook3744book17
8
9
10(array size)nth_elementsoutput_orientationoutput_styleoutput
1124{1,2,4}omittedomitted43book
12bookFALSE
1346.89#CALC!basic typesadvanced types
14FALSE1dt:NUMBER1dt:NUMBER
15TRUE2dt:TEXT2dt:TEXT
16#CALC!3dt:BLANK31dt:BLANK_REAL
174dt:LOGICAL32dt:BLANK_FORMULA
18FALSE16dt:ERROR41dt:LOGICAL_TRUE
1924{1,2,4}1omitted43book42dt:LOGICAL_FALSE
20bookFALSE160dt:ERROR_EXTERNAL!
2146.89#CALC!161dt:ERROR_NULL!
22FALSE162dt:ERROR_DIV/0!
23TRUE163dt:ERROR_VALUE!
24#CALC!164dt:ERROR_REF!
25165dt:ERROR_NAME?
26FALSE166dt:ERROR_NUM!
2724{1,2,4}2omitted43book46.89TRUE#CALC!FALSE167dt:ERROR_N/A!
28book#CALC!FALSE168dt:ERROR_GETTING_DATA!
29FALSE169dt:ERROR_SPILL!
3014{1,2,4}omitted1431610dt:ERROR_CONNECT!
31book1611dt:ERROR_BLOCKED!
3246.891612dt:ERROR_UNKNOWN!
331613dt:ERROR_FIELD!
34TRUE1614dt:ERROR_CALC!
35#CALC!
36
37FALSE
38book
39
40#CALC!
41FALSE
42
43FALSE
4414{1,2,4}1143
45book
4646.89
47
48TRUE
49#CALC!
50
51FALSE
52book
53
54#CALC!
55FALSE
56
57FALSE
5814{1,2,4}2143book46.89TRUE#CALC!FALSEbook#CALC!FALSEFALSE
5914{1,2,4}omitted243
60book
61
62book
63
64FALSE
6546.89
66#CALC!
67
68FALSE
69TRUE
70#CALC!
71
72FALSE
7314{1,2,4}1243
74book
75
76book
77
78FALSE
7946.89
80#CALC!
81
82FALSE
83TRUE
84#CALC!
85
86FALSE
8714{1,2,4}2243bookbookFALSE46.89#CALC!FALSETRUE#CALC!FALSE
88
os-2D
Cell Formulas
RangeFormula
C2C2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
I4,G6I4=IF(1,"")
I5,E6I5=1/0
F11:H18F11=INDEX.Nth(C4:J4,{1,2,4},1)
F19:H26F19=INDEX.Nth(C4:J4,{1,2,4},1,,1)
F27:M29F27=INDEX.Nth(C4:J4,{1,2,4},1,,2)
F30:F43F30=INDEX.Nth(C4:J4,{1,2,4},1,,,1)
F44:F57F44=INDEX.Nth(C4:J4,{1,2,4},1,,1,1)
F58:S58F58=INDEX.Nth(C4:J4,{1,2,4},1,,2,1)
F59:F72F59=INDEX.Nth(C4:J4,{1,2,4},1,,,2)
F73:F86F73=INDEX.Nth(C4:J4,{1,2,4},1,,1,2)
F87:S87F87=INDEX.Nth(C4:J4,{1,2,4},1,,2,2)
Dynamic array formulas.
 
start_at demo:

1.
INDEX.Nth.xlsx
ABCDEFGHIJKLMNOPQRST
1
2#CALC!basic typesadvanced types
31dt:NUMBER1dt:NUMBER
443book46.89TRUE#CALC! FALSE2dt:TEXT2dt:TEXT
5#CALC!0notebook28FALSE#DIV/0!233dt:BLANK31dt:BLANK_REAL
61423#DIV/0!24 12orangeb4dt:LOGICAL32dt:BLANK_FORMULA
764FALSE56notebook3744book1716dt:ERROR41dt:LOGICAL_TRUE
842dt:LOGICAL_FALSE
9160dt:ERROR_EXTERNAL!
10nth_elementseverystart_atexclude_typesinclude_typesoutput161dt:ERROR_NULL!
11{1,3,3,3,4,2,1,5}omittedomittedomittedomitted#CALC!notebooknotebooknotebook0#CALC!2823FALSE162dt:ERROR_DIV/0!
12{1,3,3,3,4,2,1,5}omitted1omittedomitted#CALC!notebooknotebooknotebook0#CALC!2823FALSE163dt:ERROR_VALUE!
13{1,3,3,3,4,2,1,5}omitted2omittedomitted028notebook0FALSE#DIV/0!164dt:ERROR_REF!
14{1,3,3,3,4,2,1,5}omitted3omittedomittednotebook282828FALSEnotebook#DIV/0!23165dt:ERROR_NAME?
15{1,3,3,3,4,2,1,5}omitted4omittedomitted FALSEFALSEFALSE#DIV/0!2823166dt:ERROR_NUM!
16{1,3,3,3,4,2,1,5}omitted5omittedomitted28#DIV/0!#DIV/0!#DIV/0!23FALSE28167dt:ERROR_N/A!
17{1,3,3,3,4,2,1,5}omitted6omittedomittedFALSE232323#DIV/0!FALSE168dt:ERROR_GETTING_DATA!
18{1,3,3,3,4,2,1,5}omitted7omittedomitted#DIV/0!23#DIV/0!169dt:ERROR_SPILL!
19{1,3,3,3,4,2,1,5}omitted8omittedomitted23231610dt:ERROR_CONNECT!
20{1,3,3,3,4,2,1,5}omitted9omittedomitted#N/A1611dt:ERROR_BLOCKED!
21{1,3,3,3,4,2,1,5}omittedomitted1omitted#CALC!notebooknotebooknotebook#CALC!FALSE1612dt:ERROR_UNKNOWN!
22{1,3,3,3,4,2,1,5}omitted12omitted#CALC!0#CALC!2823FALSE1613dt:ERROR_FIELD!
23{1,3,3,3,4,2,1,5}omitted23omitted028notebook0FALSE#DIV/0!1614dt:ERROR_CALC!
24{1,3,3,3,4,2,1,5}omitted34omittednotebook282828notebook#DIV/0!23
25{1,3,3,3,4,2,1,5}omitted416omitted FALSEFALSEFALSE2823
26{1,3,3,3,4,2,1,5}omitted51omitted#DIV/0!#DIV/0!#DIV/0!FALSE
27{1,3,3,3,4,2,1,5}omitted62omittedFALSE232323#DIV/0!FALSE
28{1,3,3,3,4,2,1,5}omitted73omitted#DIV/0!23#DIV/0!
29{1,3,3,3,4,2,1,5}omitted84omitted2323
30{1,3,3,3,4,2,1,5}omitted916omitted#N/A
31{1,3,3,3,4,2,1,5}omittedomittedomitted102823
32{1,3,3,3,4,2,1,5}omitted1omitted2notebooknotebooknotebook
33{1,3,3,3,4,2,1,5}omitted2omitted3 
34{1,3,3,3,4,2,1,5}omitted3omitted4FALSE
35{1,3,3,3,4,2,1,5}omitted4omitted16#DIV/0!
36{1,3,3,3,4,2,1,5}omitted5omitted1282328
37{1,3,3,3,4,2,1,5}omitted6omitted2#CALC!
38{1,3,3,3,4,2,1,5}omitted7omitted3#CALC!
39{1,3,3,3,4,2,1,5}omitted8omitted4#CALC!
40{1,3,3,3,4,2,1,5}omitted9omitted16#N/A
41
start_at-1D
Cell Formulas
RangeFormula
B2B2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
H4,F6H4=IF(1,"")
H5,D6H5=1/0
G11:P11G11=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14})
G12:P12G12=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,1)
G13:O13G13=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,2)
G14:O14G14=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,3)
G15:N15G15=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,4)
G16:M16G16=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,5)
G17:L17G17=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,6)
G18:I18G18=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,7)
G19:H19G19=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,8)
G20G20=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,9)
G21:M21G21=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,,,,1)
G22:M22G22=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,1,,,2)
G23:L23G23=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,2,,,3)
G24:N24G24=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,3,,,4)
G25:M25G25=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,4,,,16)
G26:J26G26=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,5,,,1)
G27:L27G27=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,6,,,2)
G28:I28G28=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,7,,,3)
G29:H29G29=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,8,,,4)
G30G30=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,9,,,16)
G31:I31G31=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,,,,,1)
G32:I32G32=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,1,,,,2)
G33:I33G33=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,2,,,,3)
G34G34=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,3,,,,4)
G35G35=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,4,,,,16)
G36:I36G36=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,5,,,,1)
G37G37=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,6,,,,2)
G38G38=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,7,,,,3)
G39G39=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,8,,,,4)
G40G40=INDEX.Nth($B$5:$I$5,{1,3,3,3,4,2,1,5,8,6,14},,9,,,,16)
Dynamic array formulas.



2.
INDEX.Nth.xlsx
ABCDEFGHIJKLMNOPQR
1
2#CALC!
3
443book46.89TRUE#CALC! FALSE
5#CALC!0notebook28FALSE#DIV/0!23
61423#DIV/0!24 12orangeb
764FALSE56notebook3744book17
8
9
10(array size)nth_elementsstart_atoutput_orientationoutput_styleoutput
1118{1,2,4}3omittedomitted46.8946.8946.89
12TRUE
13TRUEbasic typesadvanced types
14#CALC!1dt:NUMBER1dt:NUMBER
152dt:TEXT2dt:TEXT
16FALSE3dt:BLANK31dt:BLANK_REAL
1718{1,2,4}31omitted46.8946.8946.894dt:LOGICAL32dt:BLANK_FORMULA
18TRUE16dt:ERROR41dt:LOGICAL_TRUE
19TRUE42dt:LOGICAL_FALSE
20#CALC!160dt:ERROR_EXTERNAL!
21161dt:ERROR_NULL!
22FALSE162dt:ERROR_DIV/0!
2318{1,2,4}32omitted46.89TRUE#CALC!FALSE163dt:ERROR_VALUE!
2446.89TRUE164dt:ERROR_REF!
2546.89165dt:ERROR_NAME?
2611{1,2,4}3omitted146.89166dt:ERROR_NUM!
27167dt:ERROR_N/A!
28TRUE168dt:ERROR_GETTING_DATA!
29#CALC!169dt:ERROR_SPILL!
301610dt:ERROR_CONNECT!
31FALSE1611dt:ERROR_BLOCKED!
3246.891612dt:ERROR_UNKNOWN!
33TRUE1613dt:ERROR_FIELD!
341614dt:ERROR_CALC!
3546.89
36
3711{1,2,4}31146.89
38
39TRUE
40#CALC!
41
42FALSE
4346.89
44TRUE
45
4646.89
47
4811{1,2,4}32146.89TRUE#CALC!FALSE46.89TRUE46.89
4911{1,2,4}3omitted246.89
5046.89
5146.89
52
53TRUE
54
55TRUE
56
57#CALC!
58
59FALSE
6011{1,2,4}31246.89
6146.89
6246.89
63
64TRUE
65
66TRUE
67
68#CALC!
69
70FALSE
7111{1,2,4}32246.8946.8946.89TRUETRUE#CALC!FALSE
72
start_at-2D
Cell Formulas
RangeFormula
C2C2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
I4,G6I4=IF(1,"")
I5,E6I5=1/0
G11:I16G11=INDEX.Nth(C4:J4,{1,2,4},1,3)
G17:I22G17=INDEX.Nth(C4:J4,{1,2,4},1,3,1)
G23:L25G23=INDEX.Nth(C4:J4,{1,2,4},1,3,2)
G26:G36G26=INDEX.Nth(C4:J4,{1,2,4},1,3,,1)
G37:G47G37=INDEX.Nth(C4:J4,{1,2,4},1,3,1,1)
G48:Q48G48=INDEX.Nth(C4:J4,{1,2,4},1,3,2,1)
G49:G59G49=INDEX.Nth(C4:J4,{1,2,4},1,3,,2)
G60:G70G60=INDEX.Nth(C4:J4,{1,2,4},1,3,1,2)
G71:Q71G71=INDEX.Nth(C4:J4,{1,2,4},1,3,2,2)
Dynamic array formulas.
 
type(s) exclusion/inclusion demo (including replace_with and if_empty):

1.
INDEX.Nth.xlsx
ABCDEFGHIJKLMNOPQ
1
2#CALC!basic typesadvanced types
31dt:NUMBER1dt:NUMBER
443book46.8920TRUE2dt:TEXT2dt:TEXT
5#CALC!0notebook283dt:BLANK31dt:BLANK_REAL
61423#DIV/0!24 4dt:LOGICAL32dt:BLANK_FORMULA
764FALSE56notebook3716dt:ERROR41dt:LOGICAL_TRUE
842dt:LOGICAL_FALSE
9160dt:ERROR_EXTERNAL!
10nth_elementseverystart_atexclude_typesoutput161dt:ERROR_NULL!
111omittedomitted1#CALC!(this output is not actually empty)162dt:ERROR_DIV/0!
122omittedomitted20163dt:ERROR_VALUE!
133omittedomitted3notebook164dt:ERROR_REF!
144omittedomitted4 165dt:ERROR_NAME?
155omittedomitted1628166dt:ERROR_NUM!
166omittedomitted1#N/A167dt:ERROR_N/A!
17{1,2}omittedomitted2#CALC!0168dt:ERROR_GETTING_DATA!
18{1,3}omittedomitted3#CALC!notebook169dt:ERROR_SPILL!
19{1,4}omittedomitted4#CALC!1610dt:ERROR_CONNECT!
20{1,5}omittedomitted16281611dt:ERROR_BLOCKED!
21{1,6}omittedomitted1#CALC!(this output is not actually empty)1612dt:ERROR_UNKNOWN!
22{2,3}omittedomitted201613dt:ERROR_FIELD!
23{2,4}omittedomitted301614dt:ERROR_CALC!
24{2,5}omittedomitted4028
25{2,6}omittedomitted160
26{3,4}omittedomitted1notebook
27{3,5}omittedomitted228
28{3,6}omittedomitted3notebook
29{4,5}omittedomitted4 28
30{4,6}omittedomitted16 
31{5,6}omittedomitted1#CALC!
32{3,3}omittedomitted2#CALC!
33{1,3,4,2}omittedomitted3#CALC!notebook0
34{1,3,3,3,4,2,1,5}omittedomitted4#CALC!notebooknotebooknotebook0#CALC!28
35
36nth_elementseverystart_atexclude_typesreplace_withoutput
371omittedomitted1"replaced"#CALC!(this output is not actually empty)
382omittedomitted2"replaced"0
393omittedomitted3"replaced"notebook
404omittedomitted4"replaced" 
415omittedomitted16"replaced"28
426omittedomitted1"replaced"#N/A
43{1,2}omittedomitted2"replaced"#CALC!0
44{1,3}omittedomitted3"replaced"#CALC!notebook
45{1,4}omittedomitted4"replaced"#CALC!
46{1,5}omittedomitted16"replaced"replaced28
47{1,6}omittedomitted1"replaced"#CALC!
48{2,3}omittedomitted2"replaced"0replaced
49{2,4}omittedomitted3"replaced"0replaced
50{2,5}omittedomitted4"replaced"028
51{2,6}omittedomitted16"replaced"0
52{3,4}omittedomitted1"replaced"notebook
53{3,5}omittedomitted2"replaced"replaced28
54{3,6}omittedomitted3"replaced"notebook
55{4,5}omittedomitted4"replaced" 28
56{4,6}omittedomitted16"replaced" 
57{5,6}omittedomitted1"replaced"replaced
58{3,3}omittedomitted2"replaced"replacedreplaced
59{1,3,4,2}omittedomitted3"replaced"#CALC!notebookreplaced0
60{1,3,3,3,4,2,1,5}omittedomitted4"replaced"#CALC!notebooknotebooknotebook0#CALC!28
61
62nth_elementseverystart_atinclude_typesoutput
631omittedomitted1#CALC!
642omittedomitted2#CALC!
653omittedomitted3#CALC!
664omittedomitted4#CALC!
675omittedomitted16#CALC!
686omittedomitted1#N/A
69{1,2}omittedomitted2#CALC!
70{1,3}omittedomitted3#CALC!
71{1,4}omittedomitted4#CALC!
72{1,5}omittedomitted16#CALC!(this output is not actually empty)
73{1,6}omittedomitted1#CALC!
74{2,3}omittedomitted2notebook
75{2,4}omittedomitted3 
76{2,5}omittedomitted4#CALC!
77{2,6}omittedomitted16#CALC!
78{3,4}omittedomitted1#CALC!
79{3,5}omittedomitted2notebook
80{3,6}omittedomitted3#CALC!
81{4,5}omittedomitted4#CALC!
82{4,6}omittedomitted16#CALC!
83{5,6}omittedomitted128
84{3,3}omittedomitted2notebooknotebook
85{1,3,4,2}omittedomitted3 
86{1,3,3,3,4,2,1,5}omittedomitted4#CALC!
87
88nth_elementseverystart_atinclude_typesif_emptyoutput
891omittedomitted1"empty"empty
902omittedomitted2"empty"empty
913omittedomitted3"empty"empty
924omittedomitted4"empty"empty
935omittedomitted16"empty"empty
946omittedomitted1"empty"#N/A
95{1,2}omittedomitted2"empty"empty
96{1,3}omittedomitted3"empty"empty
97{1,4}omittedomitted4"empty"empty
98{1,5}omittedomitted16"empty"#CALC!(this output is not actually empty)
99{1,6}omittedomitted1"empty"empty
100{2,3}omittedomitted2"empty"notebook
101{2,4}omittedomitted3"empty" 
102{2,5}omittedomitted4"empty"empty
103{2,6}omittedomitted16"empty"empty
104{3,4}omittedomitted1"empty"empty
105{3,5}omittedomitted2"empty"notebook
106{3,6}omittedomitted3"empty"empty
107{4,5}omittedomitted4"empty"empty
108{4,6}omittedomitted16"empty"empty
109{5,6}omittedomitted1"empty"28
110{3,3}omittedomitted2"empty"notebooknotebook
111{1,3,4,2}omittedomitted3"empty" 
112{1,3,3,3,4,2,1,5}omittedomitted4"empty"empty
113
types-1D-ex-in
Cell Formulas
RangeFormula
B2B2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
D6D6=1/0
F6F6=IF(1,"")
F11F11=INDEX.Nth($B$5:$F$5,1,,,,,1)
F12F12=INDEX.Nth($B$5:$F$5,2,,,,,2)
F13F13=INDEX.Nth($B$5:$F$5,3,,,,,3)
F14F14=INDEX.Nth($B$5:$F$5,4,,,,,4)
F15F15=INDEX.Nth($B$5:$F$5,5,,,,,16)
F16F16=INDEX.Nth($B$5:$F$5,6,,,,,1)
F17:G17F17=INDEX.Nth($B$5:$F$5,{1,2},,,,,2)
F18:G18F18=INDEX.Nth($B$5:$F$5,{1,3},,,,,3)
F19:G19F19=INDEX.Nth($B$5:$F$5,{1,4},,,,,4)
F20F20=INDEX.Nth($B$5:$F$5,{1,5},,,,,16)
F21F21=INDEX.Nth($B$5:$F$5,{1,6},,,,,1)
F22F22=INDEX.Nth($B$5:$F$5,{2,3},,,,,2)
F23F23=INDEX.Nth($B$5:$F$5,{2,4},,,,,3)
F24:G24F24=INDEX.Nth($B$5:$F$5,{2,5},,,,,4)
F25F25=INDEX.Nth($B$5:$F$5,{2,6},,,,,16)
F26:G26F26=INDEX.Nth($B$5:$F$5,{3,4},,,,,1)
F27F27=INDEX.Nth($B$5:$F$5,{3,5},,,,,2)
F28F28=INDEX.Nth($B$5:$F$5,{3,6},,,,,3)
F29:G29F29=INDEX.Nth($B$5:$F$5,{4,5},,,,,4)
F30F30=INDEX.Nth($B$5:$F$5,{4,6},,,,,16)
F31F31=INDEX.Nth($B$5:$F$5,{5,6},,,,,1)
F32F32=INDEX.Nth($B$5:$F$5,{3,3},,,,,2)
F33:H33F33=INDEX.Nth($B$5:$F$5,{1,3,4,2},,,,,3)
F34:M34F34=INDEX.Nth($B$5:$F$5,{1,3,3,3,4,2,1,5},,,,,4)
G37G37=INDEX.Nth($B$5:$F$5,1,,,,,1,,"replaced")
G38G38=INDEX.Nth($B$5:$F$5,2,,,,,2,,"replaced")
G39G39=INDEX.Nth($B$5:$F$5,3,,,,,3,,"replaced")
G40G40=INDEX.Nth($B$5:$F$5,4,,,,,4,,"replaced")
G41G41=INDEX.Nth($B$5:$F$5,5,,,,,16,,"replaced")
G42G42=INDEX.Nth($B$5:$F$5,6,,,,,1,,"replaced")
G43:H43G43=INDEX.Nth($B$5:$F$5,{1,2},,,,,2,,"replaced")
G44:H44G44=INDEX.Nth($B$5:$F$5,{1,3},,,,,3,,"replaced")
G45:H45G45=INDEX.Nth($B$5:$F$5,{1,4},,,,,4,,"replaced")
G46:H46G46=INDEX.Nth($B$5:$F$5,{1,5},,,,,16,,"replaced")
G47G47=INDEX.Nth($B$5:$F$5,{1,6},,,,,1,,"replaced")
G48:H48G48=INDEX.Nth($B$5:$F$5,{2,3},,,,,2,,"replaced")
G49:H49G49=INDEX.Nth($B$5:$F$5,{2,4},,,,,3,,"replaced")
G50:H50G50=INDEX.Nth($B$5:$F$5,{2,5},,,,,4,,"replaced")
G51G51=INDEX.Nth($B$5:$F$5,{2,6},,,,,16,,"replaced")
G52:H52G52=INDEX.Nth($B$5:$F$5,{3,4},,,,,1,,"replaced")
G53:H53G53=INDEX.Nth($B$5:$F$5,{3,5},,,,,2,,"replaced")
G54G54=INDEX.Nth($B$5:$F$5,{3,6},,,,,3,,"replaced")
G55:H55G55=INDEX.Nth($B$5:$F$5,{4,5},,,,,4,,"replaced")
G56G56=INDEX.Nth($B$5:$F$5,{4,6},,,,,16,,"replaced")
G57G57=INDEX.Nth($B$5:$F$5,{5,6},,,,,1,,"replaced")
G58:H58G58=INDEX.Nth($B$5:$F$5,{3,3},,,,,2,,"replaced")
G59:J59G59=INDEX.Nth($B$5:$F$5,{1,3,4,2},,,,,3,,"replaced")
G60:N60G60=INDEX.Nth($B$5:$F$5,{1,3,3,3,4,2,1,5},,,,,4,,"replaced")
F63F63=INDEX.Nth($B$5:$F$5,1,,,,,,1)
F64F64=INDEX.Nth($B$5:$F$5,2,,,,,,2)
F65F65=INDEX.Nth($B$5:$F$5,3,,,,,,3)
F66F66=INDEX.Nth($B$5:$F$5,4,,,,,,4)
F67F67=INDEX.Nth($B$5:$F$5,5,,,,,,16)
F68F68=INDEX.Nth($B$5:$F$5,6,,,,,,1)
F69F69=INDEX.Nth($B$5:$F$5,{1,2},,,,,,2)
F70F70=INDEX.Nth($B$5:$F$5,{1,3},,,,,,3)
F71F71=INDEX.Nth($B$5:$F$5,{1,4},,,,,,4)
F72F72=INDEX.Nth($B$5:$F$5,{1,5},,,,,,16)
F73F73=INDEX.Nth($B$5:$F$5,{1,6},,,,,,1)
F74F74=INDEX.Nth($B$5:$F$5,{2,3},,,,,,2)
F75F75=INDEX.Nth($B$5:$F$5,{2,4},,,,,,3)
F76F76=INDEX.Nth($B$5:$F$5,{2,5},,,,,,4)
F77F77=INDEX.Nth($B$5:$F$5,{2,6},,,,,,16)
F78F78=INDEX.Nth($B$5:$F$5,{3,4},,,,,,1)
F79F79=INDEX.Nth($B$5:$F$5,{3,5},,,,,,2)
F80F80=INDEX.Nth($B$5:$F$5,{3,6},,,,,,3)
F81F81=INDEX.Nth($B$5:$F$5,{4,5},,,,,,4)
F82F82=INDEX.Nth($B$5:$F$5,{4,6},,,,,,16)
F83F83=INDEX.Nth($B$5:$F$5,{5,6},,,,,,1)
F84:G84F84=INDEX.Nth($B$5:$F$5,{3,3},,,,,,2)
F85F85=INDEX.Nth($B$5:$F$5,{1,3,4,2},,,,,,3)
F86F86=INDEX.Nth($B$5:$F$5,{1,3,3,3,4,2,1,5},,,,,,4)
G89G89=INDEX.Nth($B$5:$F$5,1,,,,,,1,,"empty")
G90G90=INDEX.Nth($B$5:$F$5,2,,,,,,2,,"empty")
G91G91=INDEX.Nth($B$5:$F$5,3,,,,,,3,,"empty")
G92G92=INDEX.Nth($B$5:$F$5,4,,,,,,4,,"empty")
G93G93=INDEX.Nth($B$5:$F$5,5,,,,,,16,,"empty")
G94G94=INDEX.Nth($B$5:$F$5,6,,,,,,1,,"empty")
G95G95=INDEX.Nth($B$5:$F$5,{1,2},,,,,,2,,"empty")
G96G96=INDEX.Nth($B$5:$F$5,{1,3},,,,,,3,,"empty")
G97G97=INDEX.Nth($B$5:$F$5,{1,4},,,,,,4,,"empty")
G98G98=INDEX.Nth($B$5:$F$5,{1,5},,,,,,16,,"empty")
G99G99=INDEX.Nth($B$5:$F$5,{1,6},,,,,,1,,"empty")
G100G100=INDEX.Nth($B$5:$F$5,{2,3},,,,,,2,,"empty")
G101G101=INDEX.Nth($B$5:$F$5,{2,4},,,,,,3,,"empty")
G102G102=INDEX.Nth($B$5:$F$5,{2,5},,,,,,4,,"empty")
G103G103=INDEX.Nth($B$5:$F$5,{2,6},,,,,,16,,"empty")
G104G104=INDEX.Nth($B$5:$F$5,{3,4},,,,,,1,,"empty")
G105G105=INDEX.Nth($B$5:$F$5,{3,5},,,,,,2,,"empty")
G106G106=INDEX.Nth($B$5:$F$5,{3,6},,,,,,3,,"empty")
G107G107=INDEX.Nth($B$5:$F$5,{4,5},,,,,,4,,"empty")
G108G108=INDEX.Nth($B$5:$F$5,{4,6},,,,,,16,,"empty")
G109G109=INDEX.Nth($B$5:$F$5,{5,6},,,,,,1,,"empty")
G110:H110G110=INDEX.Nth($B$5:$F$5,{3,3},,,,,,2,,"empty")
G111G111=INDEX.Nth($B$5:$F$5,{1,3,4,2},,,,,,3,,"empty")
G112G112=INDEX.Nth($B$5:$F$5,{1,3,3,3,4,2,1,5},,,,,,4,,"empty")
Dynamic array formulas.
 
type(s) exclusion/inclusion demo:

2.
INDEX.Nth.xlsx
ABCDEFGHIJKLMNOPQ
1
2#CALC!basic typesadvanced types
31dt:NUMBER1dt:NUMBER
443book46.89TRUE#CALC! FALSE2dt:TEXT2dt:TEXT
5#CALC!0notebook28FALSE#DIV/0!233dt:BLANK31dt:BLANK_REAL
61423#DIV/0!24 12orangeb4dt:LOGICAL32dt:BLANK_FORMULA
764FALSE56notebook3744book1716dt:ERROR41dt:LOGICAL_TRUE
842dt:LOGICAL_FALSE
9160dt:ERROR_EXTERNAL!
10nth_elementsstart_atexclude_typesoutput161dt:ERROR_NULL!
11{1,2,3,2,2,3,4,1,8,12}omittedomitted43book46.89bookbook46.8943FALSE162dt:ERROR_DIV/0!
12book#CALC!#CALC!FALSEbook163dt:ERROR_VALUE!
1346.89#CALC!#CALC!#CALC!46.89164dt:ERROR_REF!
14FALSEFALSEFALSE165dt:ERROR_NAME?
15TRUETRUE166dt:ERROR_NUM!
16#CALC!#CALC!167dt:ERROR_N/A!
17168dt:ERROR_GETTING_DATA!
18FALSEFALSE169dt:ERROR_SPILL!
19{1,2,3,2,2,3,4,1,8,12}omitted1 bookbookbookFALSE1610dt:ERROR_CONNECT!
20book#CALC!#CALC!FALSEbook1611dt:ERROR_BLOCKED!
21#CALC!#CALC!#CALC!1612dt:ERROR_UNKNOWN!
22FALSEFALSEFALSE1613dt:ERROR_FIELD!
23TRUETRUE1614dt:ERROR_CALC!
24#CALC!#CALC!
25
26FALSEFALSE
27{1,2,3,2,2,3,4,1,8,12}omitted24346.8946.8943FALSE
28#CALC!#CALC!FALSE
2946.89#CALC!#CALC!#CALC!46.89
30FALSEFALSEFALSE
31TRUETRUE
32#CALC!#CALC!
33
34FALSEFALSE
35{1,2,3,2,2,3,4,1,8,12}omitted343book46.89bookbook46.8943FALSE
36book#CALC!#CALC!FALSEbook
3746.89#CALC!#CALC!#CALC!46.89
38FALSEFALSEFALSE
39TRUETRUE
40#CALC!#CALC!
41FALSEFALSE
42{1,2,3,2,2,3,4,1,8,12}omitted443book46.89bookbook46.8943
43book#CALC!#CALC!book
4446.89#CALC!#CALC!#CALC!46.89
45
46#CALC!#CALC!
47
48{1,2,3,2,2,3,4,1,8,12}omitted1643book46.89bookbook46.8943FALSE
49bookFALSEbook
5046.8946.89
51FALSEFALSEFALSE
52TRUETRUE
53
54FALSEFALSE
55{1,2,3,2,2,3,4,1,8,12}omitted{1,2} FALSE
56#CALC!#CALC!FALSE
57#CALC!#CALC!#CALC!
58FALSEFALSEFALSE
59TRUETRUE
60#CALC!#CALC!
61
62FALSEFALSE
63{1,2,3,2,2,3,4,1,8,12}omitted{1,3} bookbookbookFALSE
64book#CALC!#CALC!FALSEbook
65#CALC!#CALC!#CALC!
66FALSEFALSEFALSE
67TRUETRUE
68#CALC!#CALC!
69FALSEFALSE
70{1,2,3,2,2,3,4,1,8,12}omitted{1,4} bookbookbook
71book#CALC!#CALC!book
72#CALC!#CALC!#CALC!
73
74#CALC!#CALC!
75
76{1,2,3,2,2,3,4,1,8,12}omitted{1,16} bookbookbookFALSE
77bookFALSEbook
78FALSEFALSEFALSE
79TRUETRUE
80
81FALSEFALSE
82{1,2,3,2,2,3,4,1,8,12}omitted{2,3}4346.8946.8943FALSE
83#CALC!#CALC!FALSE
8446.89#CALC!#CALC!#CALC!46.89
85FALSEFALSEFALSE
86TRUETRUE
87#CALC!#CALC!
88FALSEFALSE
89{1,2,3,2,2,3,4,1,8,12}omitted{2,4}4346.8946.8943
90#CALC!#CALC!
9146.89#CALC!#CALC!#CALC!46.89
92
93#CALC!#CALC!
94
95{1,2,3,2,2,3,4,1,8,12}omitted{2,16}4346.8946.8943FALSE
96FALSE
9746.8946.89
98FALSEFALSEFALSE
99TRUETRUE
100
101FALSEFALSE
102{1,2,3,2,2,3,4,1,8,12}omitted{3,4}43book46.89bookbook46.8943
103book#CALC!#CALC!book
10446.89#CALC!#CALC!#CALC!46.89
105#CALC!#CALC!
106{1,2,3,2,2,3,4,1,8,12}omitted{3,16}43book46.89bookbook46.8943FALSE
107bookFALSEbook
10846.8946.89
109FALSEFALSEFALSE
110TRUETRUE
111FALSEFALSE
112{1,2,3,2,2,3,4,1,8,12}omitted{4,16}43book46.89bookbook46.8943
113bookbook
11446.8946.89
115
116
117
118nth_elementsexclude_typesreplace_withoutput
119{1,2,3,2,2,3,4,1,8,12}{4,16}"WWWW"43book46.89bookbook46.8943WWWW
120bookWWWWWWWWWWWWbook
12146.89WWWWWWWWWWWW46.89
122WWWWWWWWWWWW
123WWWWWWWW
124WWWWWWWW
125
126WWWWWWWW
127
types-2D-ex
Cell Formulas
RangeFormula
B2B2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
H4,F6H4=IF(1,"")
H5,D6H5=1/0
E11:M18E11=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1)
E19:M26E19=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{1})
E27:M34E27=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{2})
E35:M41E35=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{3})
E42:L47E42=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{4})
E48:M54E48=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{16})
E55:M62E55=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{1,2})
E63:M69E63=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{1,3})
E70:L75E70=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{1,4})
E76:K81E76=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{1,16})
E82:M88E82=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{2,3})
E89:L94E89=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{2,4})
E95:M101E95=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{2,16})
E102:K105E102=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{3,4})
E106:M111E106=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{3,16})
E112:L116E112=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{4,16})
E119:M126E119=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,{4,16},,"WWWW")
Dynamic array formulas.


3.
INDEX.Nth.xlsx
ABCDEFGHIJKLMNOPQRSTUVWX
1
2#CALC!basic typesadvanced types
31dt:NUMBER1dt:NUMBER
443book46.89TRUE#CALC! FALSE2dt:TEXT2dt:TEXT
5#CALC!0notebook28FALSE#DIV/0!233dt:BLANK31dt:BLANK_REAL
61423#DIV/0!24 12orangeb4dt:LOGICAL32dt:BLANK_FORMULA
764FALSE56notebook3744book1716dt:ERROR41dt:LOGICAL_TRUE
842dt:LOGICAL_FALSE
9160dt:ERROR_EXTERNAL!
10nth_elementsstart_atinclude_typesoutput161dt:ERROR_NULL!
11{1,2,3,2,2,3,4,1,8,12}omittedomitted43book46.89bookbook46.8943FALSE162dt:ERROR_DIV/0!
12book#CALC!#CALC!FALSEbook163dt:ERROR_VALUE!
1346.89#CALC!#CALC!#CALC!46.89164dt:ERROR_REF!
14FALSEFALSEFALSE165dt:ERROR_NAME?
15TRUETRUE166dt:ERROR_NUM!
16#CALC!#CALC!167dt:ERROR_N/A!
17168dt:ERROR_GETTING_DATA!
18FALSEFALSE169dt:ERROR_SPILL!
19{1,2,3,2,2,3,4,1,8,12}omitted14346.8946.89431610dt:ERROR_CONNECT!
2046.8946.891611dt:ERROR_BLOCKED!
21{1,2,3,2,2,3,4,1,8,12}omitted2 bookbookbook1612dt:ERROR_UNKNOWN!
22bookbook1613dt:ERROR_FIELD!
23{1,2,3,2,2,3,4,1,8,12}omitted3 1614dt:ERROR_CALC!
24
25
26
27{1,2,3,2,2,3,4,1,8,12}omitted4 FALSE
28FALSE
29FALSEFALSEFALSE
30TRUETRUE
31FALSEFALSE
32{1,2,3,2,2,3,4,1,8,12}omitted16 #CALC!#CALC!
33#CALC!#CALC!#CALC!
34#CALC!#CALC!
35{1,2,3,2,2,3,4,1,8,12}omitted{1,2}43book46.89bookbook46.8943
36bookbook
3746.8946.89
38{1,2,3,2,2,3,4,1,8,12}omitted{1,3}4346.8946.8943
39
4046.8946.89
41
42
43{1,2,3,2,2,3,4,1,8,12}omitted{1,4}4346.8946.8943FALSE
44FALSE
4546.8946.89
46FALSEFALSEFALSE
47TRUETRUE
48FALSEFALSE
49{1,2,3,2,2,3,4,1,8,12}omitted{1,16}4346.8946.8943
50#CALC!#CALC!
5146.89#CALC!#CALC!#CALC!46.89replace_withoutput
52#CALC!#CALC!123456123456book123456bookbook123456123456123456
53{1,2,3,2,2,3,4,1,8,12}omitted{2,3} bookbookbookbook123456123456123456book
54bookbook123456123456123456123456123456
55123456123456123456
56123456123456
57{1,2,3,2,2,3,4,1,8,12}omitted{2,4} bookbookbookFALSE123456123456
58bookFALSEbook
59FALSEFALSEFALSE123456123456
60TRUETRUE
61FALSEFALSE
62{1,2,3,2,2,3,4,1,8,12}omitted{2,16} bookbookbook
63book#CALC!#CALC!book
64#CALC!#CALC!#CALC!
65#CALC!#CALC!
66{1,2,3,2,2,3,4,1,8,12}omitted{3,4} FALSE
67FALSE
68FALSEFALSEFALSE
69TRUETRUE
70
71FALSEFALSE
72{1,2,3,2,2,3,4,1,8,12}omitted{3,16} 
73#CALC!#CALC!
74#CALC!#CALC!#CALC!
75
76#CALC!#CALC!
77
78{1,2,3,2,2,3,4,1,8,12}omitted{4,16} FALSE
79#CALC!#CALC!FALSE
80#CALC!#CALC!#CALC!
81FALSEFALSEFALSE
82TRUETRUE
83#CALC!#CALC!
84FALSEFALSE
85
types-2D-in
Cell Formulas
RangeFormula
B2B2=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],LET(i,ROWS(lookup_1D_array),j,COLUMNS(lookup_1D_array),m,MAX(i,j),e,PLSL(every),o,PLS(PO0(output_orientation)),s,PLS(PO0(output_style)),f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),r,ROWS(f),n,FILTER(TOROW(nth_elements),nth_elements<=r),a,TOROW(XTYPE(lookup_1D_array,3)),w,JAD(e,start_at,n,r,s),x,JAE(f,w),p,JAE(a,w),v,IF(OR(AND(i=1,j=1),i>j),0,1),IF(AND(i>1,j>1),NA(),JAI(JAG(SWITCH(JAL(exclude_types,include_types,replace_with),0,x,1,IF(s,JAC(exclude_types,include_types,replace_with,x,p),JAF(w,exclude_types,include_types,replace_with,x,p))),v,o),if_empty))))
H4,F6H4=IF(1,"")
H5,D6H5=1/0
E11:M18E11=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1)
E19:H20E19=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{1})
E21:I22E21=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{2})
E23:J26E23=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{3})
E27:K31E27=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{4})
E32:K34E32=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{16})
E35:K37E35=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{1,2})
E38:L42E38=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{1,3})
E43:M48E43=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{1,4})
E49:K52E49=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{1,16})
O52:W59O52=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{2,3},123456)
E53:J56E53=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{2,3})
E57:K61E57=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{2,4})
E62:K65E62=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{2,16})
E66:K71E66=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{3,4})
E72:L77E72=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{3,16})
E78:M84E78=INDEX.Nth(B4:I4,{1,2,3,2,2,3,4,1,8,12},1,,,,,{4,16})
Dynamic array formulas.
 
Updated code: more efficient code

INDEX.Nth
Excel Formula:
=LAMBDA(lookup_1D_array,nth_elements,[every],[start_at],[output_orientation],[output_style],[exclude_types],[include_types],[replace_with],[if_empty],
   LET(
      i,ROWS(lookup_1D_array),
      j,COLUMNS(lookup_1D_array),
      m,MAX(i,j),
      e,PLSL(every),
      o,PLS(PO0(output_orientation)),
      s,PLS(PO0(output_style)),
      f,TOCOL(IF(lookup_1D_array="","",lookup_1D_array)),
      r,ROWS(f),
      n,FILTER(TOROW(nth_elements),nth_elements<=r),
      w,JAD(e,start_at,n,r,s),
      x,JAE(f,w),
      v,IF(OR(AND(i=1,j=1),i>j),0,1),
      IF(
         AND(i>1,j>1),
         NA(),
         JAI(
            JAG(
               SWITCH(JAL(exclude_types,include_types,replace_with),
                  0,x,
                  1,LET(
                     a,TOROW(XTYPE(lookup_1D_array,3)),
                     p,JAE(a,w),
                     IF(
                        s,
                        JAC(exclude_types,include_types,replace_with,x,p),
                        JAF(w,exclude_types,include_types,replace_with,x,p)
                     )
                  )
               ),
               v,
               o),
            if_empty
         )
      )
   )
)

XTYPE (posted separately)

XERROR.TYPE (posted separately)

(The code for the remaining helper functions is not changed, so I'm not including them again here.)
 

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

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