0

I am looking to add a second timestamp, connected to a checkbox. I currently have it set to put a timestamp in Column D when B is filled in. I would also like a timestamp in Column O when Column A checkbox is checked.

Here is my sheet: https://docs.google.com/spreadsheets/d/1h40jXZ-V0fe8oLDSQ2NmbTDW5dk3WKgZJvZ7ROcwChY/edit?usp=sharing

Progress update:

I have figured out the 2 scripts that work separately but am struggling on how to combine them so they work simultaneously.

Script 1:

function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Work Order Queue" ) { 
var r = s.getActiveCell();
if( r.getColumn() == 2 ) { 
var nextCell = r.offset(0, 2);
if( nextCell.getValue() === '' ) 
nextCell.setValue(new Date());
}
}
}

Script 2

function onEdit() {

var s = SpreadsheetApp.getActiveSheet();

if( s.getName() == "Work Order Queue" ) { //checks that we're on the correct sheet

var r = s.getActiveCell();

if( r.getColumn() == 1 ) { //checks the column

var nextCell = r.offset(0, 14);

if( nextCell.getValue() === '' ) //is empty?

nextCell.setValue(new Date());

}

}

}
2

1 Answer 1

0

You may want to try the timestampMultipleColumns_ script with these parameters:

    // [START modifiable parameters]
    var timestampSettings = [
      {
        sheetsToWatch:       /^(Work Order Queue)$/i,
        columnLabelsToWatch: ['Received by', 'Complete'],
        columnValuesToWatch: [undefined, true],
        columnLabelsToStamp: ['Time Start', 'Phone Call Time'],
        overwriteTimestamps: [false, false],
        eraseTimestamps:     [false, false],
        columnLabelRow:      2,
        timestampFormat:     'M/d/yy H:mm am/pm',
      },
    ];
    // [END modifiable parameters]

The script lets you insert timestamps in an arbitrary number of columns in an arbitrary number of sheets.

Your Answer

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

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