Answer the question
In order to leave comments, you need to log in
How to increase the entire column of constants in Google tables by 10% without changing the structure and formatting of the table?
Hello connoisseurs.
There is a google spreadsheet file. It has a column in which there are about 1000 positions with prices. It is necessary to increase all prices by 10% without changing the structure and formatting of the table.
In Excel, this is done easily through the menu - a special insert.
Can you please tell me how it works in google spreadsheets?
Answer the question
In order to leave comments, you need to log in
You can copy a column to another sheet/book, increase it by 10% by creating another column next to it, and then copy the new column with the new data back to the original table in the "Paste Special -> Values Only" mode.
Select a column and execute the script:
function mult(multipler=1.1){
let range = SpreadsheetApp.getActiveRange();
let data = range.getValues()
.map(row=>row.map(value=>((typeof value) === (typeof 1))?value*multipler:value));
range.setValues(data);
};
function onOpen(e){
SpreadsheetApp.getUi()
.createMenu("menu")
.addItem("+ 10%", "mult")
.addToUi();
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question