Search code examples
google-sheetssumarray-formulasgoogle-sheets-formulags-vlookup

Working with OFFSET and SPLIT together to get an array of looked-up cells


I'm unable to get OFFSET to return an array of data in Google Sheets. For example in the same sheet, I have a player table which eats an animal, the eats column stores the index of the animal. I want to add up all weights.

https://docs.google.com/spreadsheets/d/1XocZ0tkb4jllXEVuJS5eS2i11V1R0YxtfuiT2dkrbVw/edit#gid=0

This is what I came up with (the example numbers might not be exactly right) but it only works with the first split value:

=SUM(IFERROR(OFFSET($H$11,SPLIT(D6,","),0,1,1),0))

Solution

  • Assuming User A is in B2 and your other table is a Named Range (1), please try:

    =ArrayFormula(sum(vlookup(split(C2,","),NamedRange1,3,0)))