I am looking to exclude formulas or blank cells when I am running my auto sort. I used the following... It sorts fine, but I wanted the numbers to be ascending: False. When I change this, it takes account of the formula I have set for my column I am sorting by and puts them all at the top and my actual data points to at the bottom where my formulas stopped... Is there a way to exclude this?

function onEdit(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("G2 List")
  var range = sheet.getRange("A2:T200");
  var columnToSortBy = 14;

 // Sorts by the values in column 14 (N)
 range.sort({column: 14, ascending: false});


enter image description here

  • It's not clear enough what you are asking. What formula do have in your column? – Rubén Jan 26 at 22:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.