Forum Discussion

daejoum's avatar
daejoum
Copper Contributor
Apr 17, 2021
Solved

LOOKUP to XLOOKUP Migration

Hello! I am currently using the following LOOKUP formula for my real estate managment spreadsheet   =LOOKUP(2;1/(Konten!$A:$A>=$EJ$3)/(Konten!$G:$G=$GD4)/(Konten!$F:$F="SOLL VZ HK");(Konten!$C:$C))...
  • SergeiBaklan's avatar
    Apr 17, 2021

    daejoum 

    I'd try to use dynamic ranges instead like

    =LOOKUP(2,1/
        (Konten!$A$1:INDEX(Konten!$A:$A, COUNTA(Konten!$A:$A))>=$EJ$3)/
        (Konten!$G$1:INDEX(Konten!$G:$G, COUNTA(Konten!$A:$A))=$GD4)/
        (Konten!$F$1:INDEX(Konten!$F:$F, COUNTA(Konten!$A:$A))="SOLL VZ HK"),
        (Konten!$C$1:INDEX(Konten!$C:$C, COUNTA(Konten!$A:$A)))
    )
    

    or, to simplify a bit

    =LET(n, COUNTA(Konten!$A:$A),
    LOOKUP(2,1/
        (Konten!$A$1:INDEX(Konten!$A:$A, n ) >= $EJ$3)/
        (Konten!$G$1:INDEX(Konten!$G:$G, n ) =  $GD4)/
        (Konten!$F$1:INDEX(Konten!$F:$F, n ) =  "SOLL VZ HK"),
        (Konten!$C$1:INDEX(Konten!$C:$C, n ))
    )
    

    Even better if you convert your range into structured table.

     

    In general I'm not sure that XLOOKUP is faster than LOOKUP.  In any case, since you have mix of exact and approximate criteria, I guess XLOOKUP shall be used the same way

    =LET(n, COUNTA(Konten!$A:$A),
    XLOOKUP(1,1/
        (Konten!$A$1:INDEX(Konten!$A:$A, n ) >= $EJ$3)/
        (Konten!$G$1:INDEX(Konten!$G:$G, n ) =  $GD4)/
        (Konten!$F$1:INDEX(Konten!$F:$F, n ) =  "SOLL VZ HK"),
        (Konten!$C$1:INDEX(Konten!$C:$C, n ))
    )
    

    As for the second formula, in example second XLOOKUP returns reference on the column (see third parameter). In your formula

    =XLOOKUP(Tabelle1!EJ3;
       Konten!A:A;
       XVERWEIS(Tabelle1!GD3;
                Konten!G:G;
                XVERWEIS("SOLL VZ HK";
                         Konten!F:F;
                         Konten!C:C)
    ))

    nested XLOOKUP returns reference on the cell where array is expected.

Resources