-1

I need to create a date column that automatically returns the date in which I filled its neighbour cell. For example, when I enter data to cell A2, B2 will return the date the data was entered to A2.

  • =If(A2="","",A2) write this formula in B2 and drag it – yass Apr 16 '17 at 17:00
0

Adapted from @JPV's answer:

function onEdit(e) {
var s = e.source.getActiveSheet(),
    watchCols = [1],
    offsetCol = [1],
    ind = watchCols.indexOf(e.range.columnStart)
    if (s.getName() !== "Sheet1" || ind === -1) return;
e.range.offset(0, offsetCol[ind])
    .setValue(!e.value ? null : Utilities.formatDate(new Date(), "GMT", "yyyy.MM.dd"))
}

Date in 'scientific' format and based around GMT. Only applies to Sheet1.

Copy code into Tools > Script editor..., Save it (Ctrl+S), Run it (►) and give it permission.

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.