Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

324
Views
clear a cell based on the contents of another cell

I have on a google spreadsheet on the sheet "SUIVI ANIM", a column Y whose each cell contains from line 5, a drop-down menu. Then I have in column Z a small "x". I would like that when in column Y, it is "Submit LEAD" which is selected that automatically the small "x" of column Z is erased. For example, if "Submit LEAD" in Y3 then Z3 is empty. If "Submit LEAD" in Y4 then Z4 empties etc.

I searched and found this script:

function onEdit(e) {

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();
  
  // identify the range and values to watch and clear
  var watchCol = 25; // Column Y
  var watchValue = "Submit LEAD";
  var clearCol = 26; // Column Z
  // 

  // Logger.log("DEBUG: the column = "+e.range.columnStart+", and the value = "+e.value)
  if (e.range.columnStart === watchCol && e.value === watchValue) {
    // Logger.log("DEBUG: the conditions were met");   
    sheet.getRange(e.range.rowStart, clearCol).clearContent()
  }
  return false;
}

But it doesn't work and the debug tells me it's wrong from the line: if (e.range.columnStart === watchCol && e.value === watchValue) {

I'm new to scripting and I'm French so sorry if I'm not very clear.

Thanks for any help you could give me. émilie

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You cannot return anything to a trigger

function onEdit(e) {
  var sh = e.range.getSheet();
  if (e.range.columnStart == 25 && e.value == "Submit LEAD") {
    sheet.getRange(e.range.rowStart, 26).clearContent();
  }
}

Normally people put a sheet name in the conditional so that it only runs on selected sheets.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!