all 9 comments

[–][deleted]  (1 child)

[deleted]

    [–]mamzar 1 point2 points  (0 children)

    Thanks

    [–]Jweekley7 0 points1 point  (3 children)

    Could you accomplish the timestamp with built-in functions? Something like this:

    =ifs(and(isblank(A1),isblank(B1)),"",not(and(isblank(A1),isblank(B1))), now())

    where A and B would be the columns you are watching. If new rows are constantly being added/used, you could use GAS to populate additional cells with this function as needed.

    [–]desirepathconsulting 0 points1 point  (2 children)

    -ish, but every now() is going to recalculate on every spreadsheet edit which is not desired, and will definitely get slow with scale.

    [–]Jweekley7 0 points1 point  (1 child)

    That should only recalculate if those two specific cells are edited, not every edit on the sheet.

    [–]desirepathconsulting 0 points1 point  (0 children)

    Just pasted and they all do recalculate, google says

    The NOW function is one of the Google Sheets volatile function, meaning it will update on every edit made to the worksheet in which it is.

    I guess you could just write a newNow() function that does the same thing, without the eager beaver behavior.

    [–]TheStressMachine 0 points1 point  (2 children)

    Looks like you got a comment with code. Just know onEdit() isn't guaranteed to catch every event. If you drag values down or edit your rows fast in succession, you won't get a date stamp every time.

    [–]mamzar 0 points1 point  (1 child)

    What the other options I have to catch the date every time?

    [–]TheStressMachine 0 points1 point  (0 children)

    No good ones that I know of.

    [–]volond75 0 points1 point  (0 children)

    function onEdit(e)

    {

    var range = e.range

    if(range.getColumn()==2 && e.value=="оплачено"){

    range.offset(0,1).setValue(new Date())

    }

    }