Forum Discussion

GraemeNZ's avatar
GraemeNZ
Brass Contributor
Dec 08, 2022
Solved

Using XLOOKUP to return multiple (variable) rows

Hi We have a spreadsheet which records many data on separate tabs. The workbook is typically used for a year, so there are a few thousand rows overall. We extract some of these data onto a daily pri...
  • HansVogelaar's avatar
    HansVogelaar
    Dec 08, 2022

    GraemeNZ 

    If you want to return non-adjacent columns, you can use another FILTER, or INDEX combined with SEQUENCE.

     

    For example

    =FILTER(FILTER(CIP!C6:N63847, CIP!M6:M63847=N2, ""), {1,1,0,1,1,1,1,1,1,1,1,1})

    The 0 in 3rd place in {1,1,0,1,1,1,1,1,1,1,1,1} skips the 3rd column in C:N.

     

    Or:

    =FILTER(INDEX(CIP!C6:N63847, SEQUENCE(ROWS(CIP!C6:N63847)), {1,2,4,5,6,7,8,9,10,11,12}), CIP!M6:M63847=N2, "")

    Here, {1,2,4,5,6,7,8,9,10,11,12} specifies the column numbers within C:N that you want to include.

    You can also use this method to change the order in which the columns are returned - simply change the array {1,2,4,5,6,7,8,9,10,11,12}.

Resources