Search code examples
arraysgoogle-sheetsgoogle-sheets-formulavlookupgoogle-query-language

Vlookup Text Inside Query Results in Google Sheets


I'm trying to edit a sheet and use vlookup to get a text from another tab but I'm getting an #N/A error.

What I would like to achieve is to get "March 1st" of the notes tab to G65 of the contacts tab. However, the data in the notes tab from columns A to I is a query from the contacts tab while the "type your notes here" column is not.

Contacts tab

Notes tab

Formula bar shows correct value


Solution

  • referencing a reference which gets referenced kinda creates a paradox so this route is not possible. therefore try:

    =ArrayFormula(IFERROR(VLOOKUP(B7:B17, 
     {query(Contacts!A7:I,"Select B Where F is not null order by F"),
      query('Notes (View Only)'!J3:J, "where J is not null")}, 2, 0)))
    

    1st column of 2nd VLOOKUP argument must contain the same stuff that 1st argument of VLOOKUP in your case it's not so you will need to switch them...

    =VLOOKUP(B65, {'Notes (View Only)'!B3:B9, 'Notes (View Only)'!A3:J9}, 1, 0)
    

    and if you want also the 9th column use:

    =VLOOKUP(B65, {'Notes (View Only)'!B3:B9, 'Notes (View Only)'!A3:J9}, {1, 10}, 0)
    

    or maybe you just need:

    =VLOOKUP(B65, 'Notes (View Only)'!B3:J9, 9, 0)