Reputation: 145
I currently have a dataset filled with the following pattern:
My goal is to get each value into a different cell.
I have tried with the following formula, but it's not yielded the results I am looking for.
=SPLIT(D8,"[Stock]",FALSE,FALSE)
I would appreciate any guidance on how I can get to the ideal output, using Google Sheets.
Thank you in advance!
Upvotes: 0
Views: 68
Reputation: 9355
I will assume here from your post that your original data runs D8:D.
If you want to retain [Stock]
in each entry, try the following in the Row-8 cell of a column that is otherwise empty from Row 8 downward:
=ArrayFormula(IF(D8:D="",,TRIM(SPLIT(REGEXREPLACE(D8:D&"~","(\[Stock\]).","$1~"),"~",1,1))))
If you don't want to retain [Stock]
in each entry, use this version:
=ArrayFormula(IF(D8:D="",,TRIM(SPLIT(REGEXREPLACE(D8:D&"~","\[Stock\].","~"),"~",1,1))))
These formulas don't function based on using any punctuation at all as markers. They also assure that you don't wind up with blank (and therefore unusable) cells interspersed for ending SPLIT
s.
Upvotes: 1
Reputation: 5852
,
only used in the separator=ARRAYFORMULA(SPLIT(D8:D,", ",FALSE))
,
used also in each string ([stock]
will be replaced)=ARRAYFORMULA(SPLIT(D8:D," [Stock], ",FALSE))
,
used also in each string ([stock]
will not be replaced)=ArrayFormula(SPLIT(REGEXREPLACE(M9:M11,"(\[Stock\]), ","$1♦"),"♦"))
Upvotes: 1