Search code examples
if-statementgoogle-sheetsgoogle-sheets-formulavlookuparray-formulas

Google Sheets Index-Split functionality inside Arrayformula


Given the string in Column A and the number in column B, I need to create a formula (Arrayformula) on Column C that will split Column A and bring in the n-th string. Column B determines the "n" (the n-th number).

Here is a sample Spreadsheet https://docs.google.com/spreadsheets/d/14plMNGpgKCsO-MQgQw1oFYsOVxIu3SWwllrDzpN0YFI/edit#gid=0

I know that this can be easily with Index-Split but I need the Arrayformula since it can sit at the header and not worry about the formula being written over.


Solution

  • try:

    =ARRAYFORMULA(IF(A1:A10="",,VLOOKUP(ROW(A1:A10), 
     {ROW(A1:A10), SPLIT(A1:A10, "|")}, B1:B10+1, 0)))
    

    enter image description here