1

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")");
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.

| improve this answer | |
  • 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). – Rubén Sep 13 '19 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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