Google Sheets – Hide Row When Specific Cell is Filled

google sheets

I am trying to hide a row of cell when a specific cell is filled in on Google Sheets

For example:

On row 2 cell E2 is filled in with "1", I want to be able to hide the entire second row.

Is there a possible way of doing this?

Best Answer

You need a script for this. This script runs on every edit (onEdit), checks whether the edit is in the 5th column (E), and if the new value is 1, then it hides the row of that cell.

function onEdit(e) {
  if (e.range.getColumn() == 5 && e.value == 1) {
    e.range.getSheet().hideRows(e.range.getRow());
  }
}