vendredi 23 août 2019

VLOOKUP inside an ARRAY to search another Google Sheets book

I have a document 'A' where I have a formula in a 'SEARCH' tab to search for a value from another 'ENTRIES' tab in Google Sheets based on a cell reference written by the user in the same 'SEARCH' tab than the formula.

If I duplicate the 'SEARCH' tab in another Google sheets document/book 'B', how should the formula be altered so that it still references 'A'?

The original formula is based on: Search a value from another tab/sheet in google sheets based on cell reference

And there is an example of how the search sheet work in here: [https://docs.google.com/spreadsheets/d/1qLcJdCn4EdV7lPOAfZ_CMak1LBkve45FL5SXyqBV3L8/edit?usp=sharing]

I also checked: Google Sheets VLOOKUP of multiple columns across multiple sheets

My original formula in book 'A' is:

    =ARRAYFORMULA(
    IF(B3<>"", SUBSTITUTE(TRANSPOSE(SPLIT(TEXTJOIN(CHAR(10)&"♦"&CHAR(10)&"♦", 1, 
        VLOOKUP(B3, {INDIRECT("pivot_r!AN:AN"), indirect("pivot_r!A:BN")}, 
                    {24,3,21,23,14,5,6,9,10,67,53,54,55,45}, 0)), CHAR(10))), "♦", ),
    IF(C3<>"", SUBSTITUTE(TRANSPOSE(SPLIT(TEXTJOIN(CHAR(10)&"♦"&CHAR(10)&"♦", 1, 
        VLOOKUP(C3, {INDIRECT("Pivot_r!AK:AK"), indirect("pivot_r!A:BN")}, 
                    {24,3,21,23,14,5,6,9,10,67,53,54,55,45}, 0)), CHAR(10))), "♦", ), 
    IF(D3<>"", SUBSTITUTE(TRANSPOSE(SPLIT(TEXTJOIN(CHAR(10)&"♦"&CHAR(10)&"♦", 1, 
        VLOOKUP(D3, {INDIRECT("pivot_r!AR:AR"), indirect("pivot_r!A:BN")}, 
                    {24,3,20,23,14,5,6,9,10,67,53,54,55,45}, 0)), CHAR(10))), "♦", ),
    IF(E3<>"", SUBSTITUTE(TRANSPOSE(SPLIT(TEXTJOIN(CHAR(10)&"♦"&CHAR(10)&"♦", 1, 
        VLOOKUP(E3, {INDIRECT("pivot_r!W:W"), indirect("pivot_r!A:BN")}, 
                    {24,3,21,23,14,5,6,9,10,67,53,54,55,45}, 0)), CHAR(10))), "♦", ),
    IF(F3<>"", SUBSTITUTE(TRANSPOSE(SPLIT(TEXTJOIN(CHAR(10)&"♦"&CHAR(10)&"♦", 1, 
        VLOOKUP(F3, {INDIRECT("pivot_r!Z:Z"), INDIRECT("pivot_r!A:BN")}, 
                    {24,3,21,23,14,5,6,9,10,67,53,54,55,45}, 0)), CHAR(10))), "♦",),
    ))))))

I was trying to use : VLOOKUP(search_key, importrange, index, [is_sorted]) to get in an IMPORTRANGE, like:

    =ARRAYFORMULA(
    IF(B3<>"", SUBSTITUTE(TRANSPOSE(SPLIT(TEXTJOIN(CHAR(10)&"♦"&CHAR(10)&"♦", 1, 
        VLOOKUP(B3, {(importrange("https://docs.google.com/spreadsheets/d/LONGSERIES/edit?usp=drive_web&ouid=longnumber00000","pivot_r!AN:AN"), (importrange("https://docs.google.com/spreadsheets/d/LONGSERIES/edit?usp=drive_web&ouid=longnumber00000/edit?usp=drive_web&ouid=113818097366760392999","pivot_r!A:BN")},  
                    {24,3,21,23,14,5,6,9,10,67,53,54,55,56,57,58,59,30,61,27,62,63,64,65,41,38,36,37,31,32,33,34,45}, 0)), CHAR(10))), "♦", ),
    IF(C3<>"", SUBSTITUTE(TRANSPOSE(SPLIT(TEXTJOIN(CHAR(10)&"♦"&CHAR(10)&"♦", 1,  ......

It marks as ERROR, but even if I change it to be 1 IMPORTRANGE that gets into () both references, it still marks ERROR.

Any ideas on how to modify the formula so that it searches another Google Sheets Book?

Aucun commentaire:

Enregistrer un commentaire