Google Sheets – Auto-Populate Cells Based on Previous Cell Values

formulasgoogle sheetsgoogle-sheets-arrayformulavlookup

I have two columns with information. Values in Column B have been manually added to match the values in Column A.

Is it possible to have a function that auto-populates column B with the right values based on what comes before the new rows (i.e 998, 999)?

Column A might have a different order each time new rows get added.

        A         B        
     Product  Category    
  1   Apple    Fruit  
  2   Orange   Fruit    
  3   Beets    Vegetable  
  4   Cake     Dessert    
  5   Carrot   Vegetable  
  9   Apple    Fruit
...
998   Beets    ?
999   Apple    ?

Is this possible in Google Sheets?

Best Answer

  • yes it is if the "sample" (A2:B6) is large enough:

    =ARRAYFORMULA(IFERROR(VLOOKUP(A7:A, A2:B6, 2, 0)))

    0