B
B
baxxopult2022-01-28 02:00:21
Google Sheets
baxxopult, 2022-01-28 02:00:21

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

2 answer(s)
D
dollar, 2022-01-28
@dollar

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.

G
Grigory Boev, 2022-01-28
@ProgrammerForever

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);
};

You can add to the menu:
function onOpen(e){
  SpreadsheetApp.getUi()
  .createMenu("menu")
  .addItem("+ 10%", "mult")
  .addToUi();
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question