2

There are two columns N and O.

When any cell in column N is filled the adjoining cell in column O needs to filled with "Yes" if not it stays empty.

This is the script I'm using.

var s = SpreadsheetApp.getActiveSheet();
    if( s.getName() == "Sheet 1" ) 
    {
        var r = s.getActiveCell();
           if( r.getColumn() == 14 && r.getValue() == '') 
           {
              var nextCell = r.offset(0, 2);
                  nextCell.setValue("YES");
           }
    }

How can I change/modify the above script to show if when a cell is filled in a particular column then the adjoining cell shows as "Yes"

Or simply put translate this formula into a script

=if(ISBLANK(N2),"","Yes")

Without using it in this form

var cell = sheet.getRange("C2:C1000");
cell.setFormula("=if(ISBLANK(N2),"","Yes")");

1 Answer 1

0

Simply use this formula :

=ARRAYFORMULA(IF(A1:A="INVOICE NO.","SUPPLIER MAIL",IF(ISBLANK(A$1:A),"","YES")))

And erase any manual value under B1.
This should work.

1
  • 1
    Include ARRAY_CONSTRAIN to avoid filling the blank rows with a empty text value otherwise this will make the spreadsheet recalculation slower. By the other hand, instead of "", it's better to leave the argument empty (while other spreadsheet apps don't allow this, Google Sheets does). Sep 13, 2019 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.