Google-sheets – Insert row after every new value in Google Sheets

google sheets

A
--
1
1
1
2
2
2
7
7

I want to insert a row after every group of unique values, such that the end result would be:

A
--
1
1
1

2
2
2

7
7

How would I do this in Google Sheets?

Best Answer

The backreference \1 is not supported by Google sheets' regex so =Regexreplace is difficult to use. (https://github.com/google/re2/blob/master/doc/syntax.txt)

So a possible hack is :

=transpose(split(
    join("|",
        ArrayFormula(REPT(UNIQUE(A1:A10)&"|",
            ArrayFormula(COUNTIF(A1:A10,UNIQUE(A1:A10)))
         ))
       )
,"|",true,false))

Proof : enter image description here