Pregunta

In A1 cell I have A,B,C,,E. I want to split the cell into five cells: A , B, C, , E

This formula =split(A1,",") splits into four cells A, B, C, E and skips over the blank.

How do I tell it to split "properly"?

¿Fue útil?

Solución

I don't think you can specify that directly, though here is a workaround:

  1. Add another delimiter character to your string. So replace , with say ,|
  2. Now when you split with ,, we know for sure that even empty columns will have a character (in this case |)
  3. Use replace to substitute the extra delimiter | with a blank string
  4. Since output of split is an array, you will need to use arrayformula

Here is what the final formula would look like

=arrayformula(substitute(split(substitute(A1,",",",|"),","), "|",""))

Otros consejos

If you use FALSE as the fourth argument, it will work as expected. Try using

=SPLIT(A2,",", TRUE, FALSE)

and you won't need to do work arounds

the output for above formula

For a workaround I have an alternative suggestion: Replace ,, with , , prior to =split.

However the 'proper' way is probably is to override the default remove_empty_text parameter:

=split(A1,",",,)

An alternative is to skip the SPLIT function and apply Split text into columns... instead (under Data). This will leave D1 of length 0.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top