Adding blank rows in a set of data in Google Sheets

Viewed 2558
2 Answers

Solution:

  • IF it's the third row, Add 3 bunnies separated by a space, else keep the values as it is
  • JOIN them all and SPLIT by a bunny and TRANSPOSE

Sample:

=ARRAYFORMULA(TRANSPOSE(SPLIT(TEXTJOIN("",1,IF(MOD(ROW(A2:A16),3)=1,A2:A16&REPT(" ",3),A2:A16)),"")))

Some time ago, I created this custom function that may help you. I changed it slightly to meet your requirement and added it to the script editor.

function rowsBetween(range, s, rowsWithData, text) {
var n = [],
    a = [],
    i = 0;

while (i < s) {
    a.push(text
    )
    i++;
}
range.forEach(function(r, i) {

    n.push(r);
     if((i + 2) % rowsWithData == 1) {
    a.forEach(function(x) {
        n.push(x);
    });
    }
});
return n;
}

This script will allow you to enter in the spreadsheet this (custom) formula (see also cell E2)

=rowsBetween(A2:A16, 2, 12,)

See if that works for you?

Related