In a column, how can you make an alternate data? I mean for example I want to populate TI,TO
for every each row in a column like this.
TYSM for Help
In a column, how can you make an alternate data? I mean for example I want to populate TI,TO
for every each row in a column like this.
TYSM for Help
A script seems overkill when:
=if(isodd(row()),"TI","TO")
copied down will achieve the same result (switch I
and O
if starting in an even numbered row) or simpler still just enter TO
in a cell immediately below one containing T1
, select the pair and drag the fill handle down.
Here is a example:
function tito(){
var sheet = SpreadsheetApp.getActiveSheet();
var nb = 10; // Number of row to insert
var start = 2; // Row where it should start
var col = 1; // Colummn where it should append
var range = sheet.getRange(start, col, nb);
var array = [];
for(var i = 0; i < nb; i++){
if(isOdd(i) == 1)
array.push(["TO"]);
else
array.push(["TI"]);
}
range.setValues(array);
}
function isOdd(num) { return num % 2;}