Freeze a Range of Cells in Google Sheets

This function will allow you to freeze values by simply selecting one or more cells and clicking on Freeze Results.

The selected formulas will then be replaced with their values (and thus will no longer change subsequently).


Adding the Function

Copy and paste the following code into the script editor:

function onOpen() {
  SpreadsheetApp.getUi().createMenu('Sheets-Pratique')
    .addItem('Freeze Results', 'freeze')
    .addToUi();
}

function freeze() {
  let range = SpreadsheetApp.getActiveSheet().getActiveRange();
  range.setValues(range.getValues());
}

Then close the document and reopen it to display the new menu.

Freezing a Range

Simply select the range of cells whose formulas you want to remove and click on Freeze Results:

google sheets freeze values cells png

Note that the values of the cells are recalculated just before freezing them, so this can change the contents of the cells in some cases (especially with functions generating random data).