+ Reply to Thread
Results 1 to 8 of 8

[GOOGLE SHEETS] Date Stamp when Sheet is Updated

  1. #1
    Registered User
    Join Date
    07-05-2021
    Location
    New Jersey, USA
    MS-Off Ver
    Google Sheets
    Posts
    4

    [GOOGLE SHEETS] Date Stamp when Sheet is Updated

    I need a way to date stamp a sheet when a sheet is updated. I fill in a spreadsheet every week reporting sales transactions. I am supposed to fill in the date manually, but I often forget to update the date, or accidentally fill it out wrong. It would serve me much better if a formula could be entered that automatically entered that updated every time the sheet was updated.


    Referencing the sheet attached, I'm looking for an automatic update on A2 anytime any cell on the sheet is updated.

    As a caveat, I am working in google sheets, not excel. Most formulas translate across both platforms, but if you know that your solution is excel specific I just wanted to make you aware.

    Is this possible?

    pizzA.JPG
    Last edited by AliGW; 11-08-2021 at 11:34 AM. Reason: Thread moved to correct forum section.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: [GOOGLE SHEETS] Date Stamp when Sheet is Updated

    This is very easy to do [ In Excel, Never Use Google so try it and see ].

    Right click on the sheet name at the bottom of excel

    Select view code

    Paste this into the module that opens.

    Close the module and save the Excel Spreadsheet as file type .xlsm.

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: [GOOGLE SHEETS] Date Stamp when Sheet is Updated

    this is done using Apps Script.

    Warning: The onEdit() trigger will mess with your undo/redo history.
    The script is fired every time you edit any cell on the sheet, so the action from the trigger also gets added to the undo history, which means two things:
    1. To undo the last thing you did, you have to undo twice in quick succession (once for onEdit(), once for your edit).
    2. Since onEdit() also fires each time you undo something, it effectively gets rid of your redo history by immediately overwriting it.

    heres the script:
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: [GOOGLE SHEETS] Date Stamp when Sheet is Updated

    I would suggest to run the "onEdit" script only if the edited cell is in the range A3:H to prevent running unnecesarily.

    .

  5. #5
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: [GOOGLE SHEETS] Date Stamp when Sheet is Updated

    @Haluk,
    The onEdit(e) trigger runs automatically when a user changes the value of any cell in a spreadsheet.
    source: https://developers.google.com/apps-s...iggers#onedite

  6. #6
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: [GOOGLE SHEETS] Date Stamp when Sheet is Updated

    @janmorris;

    I know what the events, simple/installable triggers are and use them in my applications effectively .... don't worry about that.

    What i tried to say in my message #4 is; if the table is in range say A3:H10 then, if you do not define this range in your "onEdit" function, then it will run also when any cell is edited out of this range as well. This will effect the performance and also may yield unwanted results.

    So, it would be better if the working range is defined and after checking the edited cell is in this range, you allow the "onEdit" function to run. If not, you don't allow it to run..... and, this is to be coded in the "onEdit" function.

    Hope, i am clear....

    .
    Last edited by Haluk; 11-10-2021 at 05:58 AM.

  7. #7
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: [GOOGLE SHEETS] Date Stamp when Sheet is Updated

    @Haluk,
    as mentioned in #5, the script onEdit will run every time an edit is done by the user, onEdit does not discriminate running when a range is defined because the script must run to check if the range is included.

    however, do you have a working script that demonstrates what you have suggested, so that the date updates only when data is updated in a specific range?
    Last edited by janmorris; 11-10-2021 at 06:28 AM.

  8. #8
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: [GOOGLE SHEETS] Date Stamp when Sheet is Updated

    Of course "onEdit" function will run whether if the edited cell is in the range or not, but will not perform the necessary actions if it's not in the defined range .


    The following script is for range C2:E10

    Please Login or Register  to view this content.
    Last edited by Haluk; 11-10-2021 at 07:14 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Google Sheets Master Sheet that pulls in data from other sheets with the last edit date
    By Badvgood in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 2
    Last Post: 12-19-2020, 12:04 PM
  2. Google Sheets: How to keep time stamp unchanged if any changes in the the other data cell?
    By azar3 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 16
    Last Post: 08-08-2020, 04:29 AM
  3. Migrate VBA that sets time stamp to Google Sheets
    By marko737 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 8
    Last Post: 12-15-2019, 03:03 PM
  4. Migrate VBA that sets time stamp to Google Sheets
    By marko737 in forum Excel General
    Replies: 6
    Last Post: 12-15-2019, 02:32 AM
  5. Date Stamp When Excel sheet Updated
    By sabeen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-05-2015, 02:35 AM
  6. Date and Time stamp column when row updated
    By batman1056 in forum Excel General
    Replies: 6
    Last Post: 02-11-2011, 07:10 AM
  7. Date stamp when doc is updated
    By wind1star in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-29-2009, 05:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1