1
votes

I have this formula on Google sheets:

=ARRAYFORMULA(IFERROR(IF(ISBLANK(A2:A),SPLIT(REGEXREPLACE(C2:C,",","+VITAMIN "),"+"),SPLIT(A2:A,"+"))))

How do i remove spaces on left after my split?

You can see example in column F in this example:

https://docs.google.com/spreadsheets/d/15ZU_mUrnTvhssgHF231dHKFjjsD7t_0pEFm0ysKoL6A/edit#gid=0

1

1 Answers

2
votes

For example, how about using TRIM as follows?

Modified formula:

=ARRAYFORMULA(TRIM(IFERROR(IF(ISBLANK(A2:A),SPLIT(REGEXREPLACE(C2:C,",","+VITAMIN "),"+"),SPLIT(A2:A,"+")))))

and

=ARRAYFORMULA(IFERROR(IF(ISBLANK(A2:A),TRIM(SPLIT(REGEXREPLACE(C2:C,",","+VITAMIN "),"+")),TRIM(SPLIT(A2:A,"+")))))

Reference: