skip to Main Content

I am looking for an assistance on creating an App Script. This script needs to do the following:

  1. Go to the last row of the active Sheet.
  2. Look at the value in last cell of column I, which is Yes or No.
  3. Based on the value of the last cell of column I, a new value is assigned to the last cell of column A;
    • Yes = "RUSH"
    • No = "New"

It seems like it would be a simple task, but I can’t seem to figure it out. I have been searching for examples, modifying them, and testing it all day with no luck. Any help would be greatly appreciated.

Thank you all!

2

Answers


  1. function myfunk() {
      const ss = SpreadsheetApp.getActive();
      const sh = ss.getActiveSheet();
      const lr = sh.getLastRow();
      const obj = {yes:"RUSH",no:"NEW"};
      sh.getRange(lr,1).setValue(obj[sh.getRange(lr,sh.getLastColumn()).getDisplayValue().toLowerCase()]);
    }
    
    Login or Signup to reply.
  2. Recommendation:

    This script will get the last row and input "RUSH" or "New" in the last row of column A based on the last cell of column I if it is "Yes" or "No".

    function yesOrNo() {
      var ss = SpreadsheetApp.getActiveSheet();
      var lastRow = ss.getLastRow()
      
      var value = ss.getRange(lastRow,9).getValue();
    
      if (value == "Yes"){
        ss.getRange(lastRow,1).setValue("RUSH");
        }
      else {
          ss.getRange(lastRow,1).setValue("New");
        }
      }
    

    References:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search