I have this values:
And I would like the formula to ignore blank cells, with the final result in the following sequence:
I tried t
How about this modified formula?
=ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(REGEXREPLACE(TEXTJOIN(",",TRUE,A1:D),"(([\w\s]+,){3}[\w\s]+)","$1@"),"@")),",")))
TEXTJOIN
.@
to the joined text value for 4 columns using REGEXREPLACE
.@
using SPLIT
.TRANSPOSE
.,
using SPLIT
.,
and @
are included in the cell values, please change them in the formula.About I guess this will fail, if cell values are more than 1 character.
of TheMaster's comment, I tested it as follows.
For OP's new situation, I added the below modified formula. In this case, the regex is modified.
=ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(REGEXREPLACE(TEXTJOIN(",",TRUE,A1:D),"(([\w\s\S]+?,){4})","$1@"),"@")),",")))