I want to mirror column "A" and through a formula keep adding to the sequence in bold.
Is there a way to have it so I don't need to manually input the numbers in sequence?
Thanks.
I want to mirror column "A" and through a formula keep adding to the sequence in bold.
Is there a way to have it so I don't need to manually input the numbers in sequence?
Thanks.
You could do this with an Apps Script Custom Function.
First, open a bound script by selecting Tools > Script editor, and copy the following functions to the script:
function MIRROR(until) {
const sheet = SpreadsheetApp.getActive().getSheetByName("Question");
const lastRow = getLastDataRow(sheet);
const values = sheet.getRange(1, 1, lastRow).getValues();
let series = values.slice(0, 4);
let output = [];
let currentNumber = values[values.length - 2][0] + 1;
if (!until) currentNumber;
for (; currentNumber <= until; currentNumber++) {
output.push([[currentNumber],[series[1][0]],[""],[""]]);
}
return output.flat();
}
function getLastDataRow(sheet) { // Get last row in column A (see https://stackoverflow.com/a/53587462)
var lastRow = sheet.getLastRow();
var range = sheet.getRange("A" + lastRow);
if (range.getValue() !== "") {
return lastRow;
} else {
return range.getNextDataCell(SpreadsheetApp.Direction.UP).getRow();
}
}
Once it is defined, you can use the function MIRROR
the same you would any sheets built-in function. This function would accept a parameter in which you would specify until what number should the series continue. See, for example, this: