1

I am using these functions in my google sheets. With an array literal, I am getting an error when there are comma-separated inputs which need to be split but its working fine when there is only value in the K column. It's working fine without column title. Can someone explain the error in the first code?

={"Don't Edit this Column TargetGroup ID";Arrayformula(IFERROR(SPLIT(MainSheet!K2:K,",",TRUE, True),""))}

and

 =Arrayformula(IFERROR(SPLIT(MainSheet!K2:K,",",TRUE, True),""))
swapnilindahood
  • 107
  • 2
  • 9

1 Answers1

1

Try this one:

={
  "Don't Edit this Column TargetGroup ID", Arrayformula(SPLIT(REPT(",", COLUMNS(SPLIT(MainSheet!K2:K,",")) - 2), ",", True, False));
  Arrayformula(IFERROR(SPLIT(MainSheet!K2:K,","),""))
}

You had only one string value for the first raw in you array literal ({}), so it is only one column.

Presumably, SPLIT found at least one comma and gave you a minimum of two column range which cannot be attached to that first row of yours (the header string) from the bottom as they do not match column-wise.

This SPLIT(REPT(...), ...) gives a needed number of empty cells to append to the right of your header so the number of columns will match.


If that is not the case then please provide a error message or, even better, share a sample sheet where this issued is reproduced.

kishkin
  • 5,152
  • 1
  • 26
  • 40