Search code examples
google-sheetsspreadsheetarray-formulasgs-vlookup

Array formula is misbehaving


I want to add an extra column which takes a value with a VLOOKUP from another sheet and adds the value to each cell in that column if the value's ID matches an id from another column in this spreadsheet.

I have partial success with my formula. It is working for almost all the cells/rows, but it won't populate the last 9 cells(out of 3000 rows) with the desired value.

Here is the formula :

=ARRAYFORMULA(VLOOKUP(G3:INDEX(G3:G,COUNT(G3:G)),'Program IDs'!A$1:B$17,2,0))

I don't understand what is wrong in my formula. Also, the data in the problematic rows is perfectly fine and in the same format as in the other rows.

If my formula seems correct, then I'd like to get suggestions for alternatives to that formula, so I can make it work one way or another.


Solution

  • =ARRAYFORMULA(VLOOKUP(G3:INDEX(G3:G,COUNT(G3:G)+9),'Program IDs'!A$1:B$17,2,0))
    

    There are 9 blank rows somewhere in your 3000 rows. I've made the necessary changes.