title: Google Sheet scripts
body: <p>I created the following script to sort data on certain pages in google sheets, and it will only run the second function and not the first one. I am new to programming and switching over to sheets from excel. I am sure its something small and obvious, but i can't figure it out. I appreciate any help.</p>
  
  <pre><code>function onEdit(event){
  var sheet = event.source.getActiveSheet();
  if(sheet.getName() ==='ADMIN')
  var editedCell = sheet.getActiveCell();
  
  var columnToSortBy = 1;
  var tableRange = "A2:G48"; // What to sort.
  
  if(editedCell.getColumn() == columnToSortBy){   
  var range = sheet.getRange(tableRange);
  range.sort( { column : columnToSortBy, ascending: true } );
  }
  }
  
  function onEdit(event){
  var sheet = event.source.getActiveSheet();
  if(sheet.getName() ==='HQ', 'ARMT', 'MAINT', 'AVNX', 'SHOPS')
  var editedCell = sheet.getActiveCell();
  
  var columnToSortBy = 2;
  var tableRange = "A4:D40"; // What to sort.
  
  if(editedCell.getColumn() == columnToSortBy){   
  var range = sheet.getRange(tableRange);
  range.sort( { column : columnToSortBy, ascending: true } );
   } 
  }
  </code></pre>