7

I'm using Google Spreadsheet's NOW() function as a shortcut to insert the current timestamp now.

However, the value in the cell changes whenever the spreadsheet is modified in any way, even when the changes have nothing to do with that particular cell.

How do we stop the value in the cell from being automatically updated?

11

Try Shift+Ctrl+: and Ctrl+;

Those are the keyboard shortcuts for "insert time" and "insert date" respectively.

(based on pnuts' comment)

  • 1
    Some shortcuts, including date and time stamp, doesn't work for some international keyboard layouts for the Google Editors (Docs, Drawings, Sheets, Slides). It's a "known" issue. Later I'll pass some references. – Rubén May 25 '15 at 16:47
  • I expect there are probably localized keyboard shortcuts for other keyboard layouts. – ale May 25 '15 at 18:14
  • I expect the same but I didn't found them yet. – Rubén May 25 '15 at 18:23
  • Not working on firefox linux :-( is there a way to get this function through menus??!! @Rubén seems you forgot the references ;-) – Philippe Gachoud May 11 '18 at 11:59
  • @PhilippeGachoud : Yeap I forgot them, I mean I don't remember what were the references I was talking about three years ago... – Rubén May 11 '18 at 14:43
4

This is an old post, but I was looking into this recently and figured I'd chime in.

Depending on you needs, the easiest answer I could think of is by creating a drop down menu and referencing a function on another cell.

Example:

  1. Select A10:A20 > right click > Data Validation
    • Criteria = "List from range" > F2
  2. Formula in cell F2: =mult(now(),1)

To insert a time and date into a data validated cell (A10:A20 in this example), click on the drop down arrow and click on the time listed. This will input the date and time into the field and not change it each time the spreadsheet is updated. If you'd like to change the formatting of the cell to be just time, or just the date, it can be done easily (select desired cell(s) > Format > Number > select format).

  • I didn't figured out this solution. Thank for sharing it. It's worth to say that using =NOW() in List from range also works by the other side it's very likely that other non-deterministic functions like TODAY(), RAND() and RANDBETWEEN could be used too. – Rubén Apr 12 '16 at 11:03
0

The documentation says this:

The NOW Function and Worksheet Recalculation The NOW() function is a member of Google Sheet's group of volatile functions, which, by default, recalculate or update every time the worksheet in which they are located recalculates.

For example, worksheets recalculate each time they are opened or when certain events occur — such as when data is entered or changed in the worksheet — so if the date or time is entered using the NOW() function, it continues to update.

The spreadsheet settings, which are located under the File menu in Google Sheets, offers two additional settings for when a worksheet recalculates:

On change and every minute On change and every hour There is no option within the program for turning off recalculation of volatile functions.

Keeping Dates and Times Static If having the date or time continually change is not desirable, use a shortcut option for entering static dates and time include typing the date or time manually or entering them using the following keyboard shortcuts:

The static date shortcut is Ctrl+; (semi-colon key) The static time shortcut is Ctrl+Shift+: (colon key)

but I would consider using the function TIMESTAMP just like this:

=TIMESTAMP()

This would give you static date time as follows

8-15-2019 16:53:52

But there is no function such as TIMESTAMP(). You can easily add this: Go to tools>Script Editor and paste the following code

function TIMESTAMP() {

  var today = new Date();
  var date = (today.getMonth()+1)+'-'+today.getDate()+'-'+today.getFullYear();
  var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
  var dateTime = date+' '+time;
  return dateTime;

}

Save the script and your sheets are now ready to use this function.

New contributor
Rishabh Gusain is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Welcome. Custom functions are recalculated every time that a spreadsheet is opened and when their arguments change. By the way a simple version is function TIMESTAMP(){ return new Date()} – Rubén Aug 15 at 12:50
-1

automatic re-calculations of volatile functions like =NOW() =TODAY() =RAND() =RANDBETWEEN() in google spreadsheet can be frozen (for 30 minutes)

here is a small example for generating two "frozen" keys implementing RANDBETWEEN:

  1. create new spreadsheed and name it "KEY1"
  2. set values for range A1:P1 like: enter image description here
  3. insert this in cell A3:

    =index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))& index($A$1:$P$1;RANDBETWEEN(1;counta($A$1:$P$1)))

  4. create a copy/duplicate of whole spreadsheet and name it "KEY2"

  5. create new (3rd) spreadsheet and name it "ALL_KEYS"

  6. enable sharing for all 3 spreadsheets and in advanced options select "Can edit" (please note that with not doing this step all will result in #REF error because those spreadsheets needs to be linked to each other)

  7. in this 3rd spreadsheet set cell A1 and A2 as follows:

    =IMPORTRANGE("paste-here-whole-url-of-KEY1-spreadsheet";"Sheet1!$A$3") =IMPORTRANGE("paste-here-whole-url-of-KEY2-spreadsheet";"Sheet1!$A$3")

  8. create new (4th) spreadsheet and name it as you wish (and also enable sharing)

  9. insert each formula in any cell (or even any Sheet tab across whole spreadsheet) example:

    D3 =IMPORTRANGE("paste-here-whole-url-of-ALL_KEYS-spreadsheet";"Sheet1!$A$1") D4 =IMPORTRANGE("paste-here-whole-url-of-ALL_KEYS-spreadsheet";"Sheet1!$A$2")

  10. right click on cell C3 and select "Data validation..." then as Criteria select "Checkbox" and check "Use custom cell values". then as TRUE input number 1 and as FALSE input number 0

  11. do same for C4 cell (this will work as on/on switch rather than on/off)

  12. now go to spreadsheets "KEY1" and "KEY2", and in both of them insert this into A2 cell:

    "KEY1" -> A2 =IMPORTRANGE("paste-here-whole-url-of-4th-spreadsheet";"Sheet1!$C$3") "KEY2" -> A2 =IMPORTRANGE("paste-here-whole-url-of-4th-spreadsheet";"Sheet1!$C$4")

  13. close spreadsheets "KEY1", "KEY2" & "ALL_KEYS", and never open them again

  14. done! bonus step: to make sure that those two randomly generated keys are unique you can add alert like =IF($A$1<>$A$2;"unique";"reload") in "ALL_KEYS" spreadsheet, and then import it into 4th spreadsheet like =IMPORTRANGE("paste-here-whole-url-of-ALL_KEYS-spreadsheet"; "Sheet1!a10")

SUM: now whenever you enable/disable your "switch" it will generate random fresh key for you which will stay there until next pushing of the switch (not even RELOAD of browser tab will change those randomly generated keys). as you can see there is a slight offset key1 in "KEY1" and key1 in "ALL_KEYS" & "4th", but that does not merit anyhow...

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.