Time stamp for excel

Home / Excel Basics / How to Insert a Timestamp in Excel [Formula + VBA + Shortcut]

A few years back when I was working for a tech company I was one of those people who were an Excel help point for all. And that’s the real reason I’m fascinated to learn more. One day the lady who was working as a reception coordinator came to me and asked:

Puneet, I’m managing a list of tasks and I want to add date and time in the corresponding cell on completion of each task. Which is the best way?

And quickly I realized that she was talking about a timestamp. I’m sure you also use it while working in Excel. In general, it contains the current date and time, and we use it to capture the completion time of a task. Now the thing is: Which is the best way to insert a timestamp in Excel?

In this post, you’ll learn how to create a timestamp in Excel using 5 different ways and we will try to figure out which is the best out of all. So let’s get started.

1. Using a Keyboard Shortcut to Insert a Timestamp

There are two different shortcuts to insert a date and a time. And, here we need to use both of them subsequently. Here are the steps:

insert a timestamp in excel using a shortcut key
  1. First of all, select the cell where you need to insert a timestamp.
  2. After that, use the shortcut key Control + : (Press and hold control and then press colon). Once you press this, it will insert the current date (according to your system) in the cell.
  3. At this time, your cell is in edit mode.
  4. Now, press Control + Shift + : (Press and hold the control and shift key and then press the colon).
  5. Your cell is still in edit mode, now press the enter key to complete the entry.

In short, you need to press two shortcuts in sequence to insert this. And, if you want to add only one thing of date and time, just skip the shortcut key.

PROs Cons
If you want to save time and have fewer cells, this method is perfect. This is not a dynamic method, you have a static timestamp. And if you want to update the time stamp you need to enter it again.
When you enter both the date and time, Excel automatically picks the right format to display it. You need to press two different shortcut keys to enter it.

2. Insert a Timestamp with NOW Function

A simple dynamic method. If you want to use a formula to insert a timestamp, the perfect way is to use the NOW function. When you enter this function in a cell it returns the current date and time according to your system’s settings.

The default format of date and time return by NOW is mm/dd/yyyy hh:mm. But for some reason, if you want a custom format, you change its format using the custom format option. Select the cell ➜ Press shortcut key control + 1 ➜ Select “Custom” ➜ Enter “mm/dd/yyyy hh:mm” in the input box ➜ Click OK.

And if you want to enter the only date then you can use TODAY instead of NOW, it only returns the current date according to the system’s settings.

insert a timestamp in excel with today

Pros

  1. It’s a dynamic method.
  2. You can use both of the functions with an IF function to create a condition to enter a timestamp if another cell has a value.

Cons

  1. Even though it’s a dynamic method but as both of the functions are volatile they will get updated whenever you make changes to your worksheet.
  2. And if you just want values instead of formulas you need to convert them into values manually.

3. Using Circular Reference for Creating a Timestamp

If you want to get into an advanced method and don’t want to use methods #1 and #2 then you can use a circular reference to insert a timestamp.

But before you learn this method let’s understand what circular reference is all about. Let’s say you have a value of 5 in cell A1 and a value of 10 in cell B1. Now if you enter a formula =A1+B1+C1 in cell C1, it will return a message circular reference error.

insert a timestamp in excel with circular reference

This is because you are using cell C1 as a reference in cell C1. When a circular reference error happens, there is a non-ending loop in the cell. Reference the cell A3 is dependent on the value of cell A3 and the value of A3 is dependent on reference to cell A3.

insert a timestamp in excel with circular reference loop

But when a circular reference is entered, Excel doesn’t calculate it and the non-ending loop never starts.

Here’s the deal:

You can enable the “iterative calculation option” to force Excel to perform the calculation at least one time and use the now function in the calculation. This way Excel will update the cell formula only one time instead of every time. Steps to enable iterative calculation option:

  1. Go to File ➜ Options.
  2. In the Excel options, select Formulas.
  3. In the Calculated options, check the Enable iterative calculation option.
  4. Click OK.
insert a timestamp in excel with circular reference activate iteration

After that in cell B2, enter the below formula in the formula bar.

=IF(A2<>"",IF(B2<>"",B2,NOW()),"")
insert a timestamp in excel with circular reference enter formula

Now when you enter any value in cell A2 the formula in cell B2 will return a timestamp.

insert a timestamp in excel with circular reference enter value

If you are a VBA freak then I’m sure you’ll find this VBA code useful. With this, you don’t need to enter a formula or even not use any shortcut key. Just select the cell where you need to enter a timestamp and run the macro.

Sub timeStamp()

Dim ts As Date

With Selection

.Value = Now
.NumberFormat = "m/d/yyyy h:mm:ss AM/PM"

End With

End Sub

How to use this code

To use this code you can add it on QAT (quick access toolbar) and run it every time whenever you need to add a timestamp.

Here are the steps:

Now you have an icon on QAT and whenever you need a timestamp you can select the cell and click this button to insert it.

4.1 Using UDF for Timestamp

Yes, you can also create a custom Excel function for inserting a timestamp in Excel. Below is the code for this UDF.

Function Timestamp(Reference As Range)
If Reference.Value <> "" Then
Timestamp = Format(Now, "dd-mm-yyyy hh:mm:ss")
Else
Timestamp = ""
End If
End Function 

By using this user-defined function you can get a timestamp in a cell if another has a value in it. Please follow the below steps:

  • Go to Developer tab and open VBA editor.
  • In VBA editor, insert a new module and paste this code into it.
  • Now, close VBA editor and come back to your worksheet.
  • In the cell B2, enter below formula.
    insert-a-timestamp-in-excel-vba-function
  • Now, when you enter any value in cell A1, cell B1 will get a timestamp.

Conclusion

Adding a timestamp is something we often do while working in Excel. And, you have 5 different methods to insert it. If you ask me I love to use the VBA button on QAT for this. The best way is to add this code in a personal.xlsb so that you can use it in all the workbooks. This is the whole story about timestamps and I’m sure you found it useful but now tell me one thing.

Do you know any other method for this?

Please share with me in the comment section, I’d love to hear from you, and please don’t forget to share this tip with your friends.

If you want to sharpen your existing Excel Skills, check out these Excel Tips and Tricks.


  • — By
    Sumit Bansal

A timestamp is something you use when you want to track activities.

For example, you may want to track activities such as when was a particular expense incurred, what time did the sale invoice was created, when was the data entry done in a cell, when was the report last updated, etc.

Let’s get started.

Keyboard Shortcut to Insert Date and Timestamp in Excel

If you have to insert the date and timestamp in a few cells in Excel, doing it manually could be faster and more efficient.

Here is the keyboard shortcut to quickly enter the current Date in Excel:

Control + : (hold the control key and press the colon key).

Here is how to use it:

  • Select the cell where you want to insert the timestamp.
  • Use the keyboard shortcut Control + :
    • This would instantly insert the current date in the cell.

Automatically insert Timestamp in Excel - Keyboard shortcut

A couple of important things to know:

  • This shortcut would only insert the current date and not the time.
  • It comes in handy when you want to selectively enter the current date.
  • It picks the current date from your system’s clock.
  • Once you have the date in the cell, you can apply any date format to it. Simply go to the ‘Number Format’ drop-down in the ribbon and select the date format you want.

Note that this is not dynamic, which means that it will not refresh and change the next time you open the workbook. Once inserted, it remains as a static value in the cell.

While this shortcut does not insert the timestamp, you can use the following shortcut to do this:

Control + Shift + :

This would instantly insert the current time in the cell.

Automatically insert date and Timestamp in Excel - shift-control-colon

So if you want to have both date and timestamp, you can use two different cells, one for date and one for the timestamp.

Using TODAY and NOW Functions to Insert Date and Timestamps in Excel

In the above method using shortcuts, the date and timestamp inserted are static values and don’t update with the change in date and time.

If you want to update the current date and time every time a change is done in the workbook, you need to use Excel functions.

This could be the case when you have a report and you want the printed copy to reflect the last update time.

Insert Current Date Using TODAY Function

To insert the current date, simply enter =TODAY() in the cell where you want it.

Automatically insert Timestamp in Excel - Using Today Function

Since all the dates and times are stored as numbers in Excel, make sure that the cell is formatted to display the result of the TODAY function in the date format.

To do this:

Note that this formula is volatile and would recalculate every time there is a change in the workbook.

Insert Date and Timestamp Using NOW Function

If you want the date and timestamp together in a cell, you can use the NOW function.

Automatically insert date and Timestamp in Excel - now function

Again, since all the dates and times are stored as numbers in Excel, it is important to make sure that the cell is formatted to have the result of the NOW function displayed in the format that shows the date as well as time.

To do this:

  • Right-click on the cell and select ‘Format cells’.
  • In the Format Cells dialog box, select ‘Custom’ category in the Number tab.
  • In the Type field, enter dd-mm-yyyy hh:mm:ssinsert-date-and-timestamp-in-excel-custom-format
  • Click OK.

This would ensure that the result shows the date as well as the time.

Note that this formula is volatile and would recalculate every time there is a change in the workbook.

Circular References Trick to Automatically Insert Date and Timestamp in Excel

One of my readers Jim Meyer reached out to me with the below query.

“Is there a way we can automatically Insert Date and Time Stamp in Excel when a data entry is made, such that it does not change every time there is a change or the workbook is saved and opened?”

This can be done using the keyboard shortcuts (as shown above in the tutorial). However, it is not automatic. With shortcuts, you’ll have to manually insert the date and timestamp in Excel.

To automatically insert the timestamp, there is a smart technique using circular references (thanks to Chandoo for this wonderful technique).

Let’s first understand what a circular reference means in Excel.

Suppose you have a value 1 in cell A1 and 2 in cell A2.

Now if you use the formula =A1+A2+A3 in cell A3, it will lead to a circular reference error. You may also see a prompt as shown below:

circular reference prompt in Excel

This happens as you are using the cell reference A3 in the calculation that is happening in A3.

Now, when a circular reference error happens, there is a non-ending loop that starts and would have led to a stalled Excel program. But the smart folks in the Excel development team made sure that when a circular reference is found, it is not calculated and the non-ending loop disaster is averted.

However, there is a mechanism where we can force Excel to at least try for a given number of times before giving up.

Now let’s see how we can use this to automatically get a date and timestamp in Excel (as shown below).

inserting the date and time automatically using circular reference

Note that as soon as I enter something in cells in column A, a timestamp appears in the adjacent cell in column B. However, if I change a value anywhere else, nothing happens.

Here are the steps to get this done:

That’s it!

Now when you enter anything in column A, a timestamp would automatically appear in column B in the cell adjacent to it.

insert-date-and-timestamp-in-excel-timestamp-demo

With the above formula, once the timestamp is inserted, it doesn’t update when you change the contents of the adjacent cell.

If you want the timestamp to update every time the adjacent cell in Column A is updated, use the below formula (use Control + Shift + Enter instead of the Enter key):

=IF(A2<>"",IF(AND(B2<>"",CELL("address")=ADDRESS(ROW(A2),COLUMN(A2))),NOW(),IF(CELL("address")<>ADDRESS(ROW(A2),COLUMN(A2)),B2,NOW())),"")

insert-date-and-timestamp-in-excel-timestamp-update-demo

This formula uses the CELL function to get the reference of the last edited cell, and if it’s the same as the one to the left of it, it updates the timestamp.

Note: When you enable iterative calculations in the workbook once, it will be active until you turn it off. To turn it off, you need to go to Excel Options and uncheck the ‘Enable iterative calculation’ option.

Using VBA to Automatically Insert Timestamp in Excel

If VBA is your weapon of choice, you’ll find it to be a handy way to insert a timestamp in Excel.

VBA gives you a lot of flexibility in assigning conditions in which you want the timestamp to appear.

Below is a code that will insert a timestamp in column B whenever there is any entry/change in the cells in Column A.

'Code by Sumit Bansal from https://trumpexcel.com
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Handler
If Target.Column = 1 And Target.Value <> "" Then
Application.EnableEvents = False
Target.Offset(0, 1) = Format(Now(), "dd-mm-yyyy hh:mm:ss")
Application.EnableEvents = True
End If
Handler:
End Sub

This code uses the IF Then construct to check whether the cell that is being edited is in column A. If this is the case, then it inserts the timestamp in the adjacent cell in column B.

Note that this code would overwrite any existing contents of the cells in column B. If you want. You can modify the code to add a message box to show a prompt in case there is any existing content.

Where to Put this Code?

This code needs to be entered as the worksheet change event so that it gets triggered whenever there is a change.

To do this:

Make sure you save the file with .XLS or .XLSM extension as it contains a macro.

Creating a Custom Function to Insert Timestamp

Creating a custom function is a really smart way of inserting a timestamp in Excel.

It combines the power of VBA with functions, and you can use it like any other worksheet function.

Here is the code that will create a custom “Timestamp” function in Excel:

'Code by Sumit Bansal from http://trumpexcel.com
Function Timestamp(Reference As Range)
If Reference.Value <> "" Then
Timestamp = Format(Now, "dd-mm-yyy hh:mm:ss")
Else
Timestamp = ""
End If
End Function

Where to Put this Code?

This code needs to be placed in a module in the VB Editor. Once you do that, the Timestamp function becomes available in the worksheet (just like any other regular function).

Here are the steps to place this code in a module:

Now you can use the function in the worksheet. It will evaluate the cell to its left and insert the timestamp accordingly.

insert-date-and-timestamp-in-excel-timestamp-formula

It also updates the timestamp whenever the entry is updated.

Make sure you save the file with .XLS or .XLSM extension as it contains VB code.

Hope you’ve found this tutorial useful.

Let me know your thoughts in the comments section.

You May Also Like the Following Excel Tutorials and Resources:

  • How to Run a Macro in Excel.
  • How to Create and Use an Excel Add-ins.
  • Select Multiple Items from a Drop Down List in Excel.
  • Inserting Date and Timestamp in Google Sheets.
  • A Collection of FREE Excel Templates.
  • Excel Timesheet Template.
  • Excel Calendar Template.
  • Convert Time to Decimal Number in Excel (Hours, Minutes, Seconds)
  • How to Autofill Only Weekday Dates in Excel (Formula)
  • Make VBA Code Pause or Delay (Using Sleep / Wait Commands)

Excel Ebook Subscribe

Get 51 Excel Tips Ebook to skyrocket your productivity and get work done faster

61 thoughts on “How to Quickly Insert Date and Timestamp in Excel”

  1. so amazing

  2. All of this is very clever and I even got it all to work using VBA to insert a time in a column to the right of where I entered some data. Perfect but .. How can you protect your code, as you can see it and edit it by doing View Code, even if the sheet and/or workbook is protected? Also when I saved it and then re-opened the worksheet it stopped working – what have I done wrong? Wonderful stuff!! Thank you.

  3. Thank you awesome work i know its hard to get these formulas running how you like and i just wanted to thank you for letting people like me steal them off the web 🙂

  4. Doesn’t work in Online Excel ?

  5. What if I want to check a range of cells B2 – G2 and if any are updated, update the date and timestamp?

  6. Thank you for all the instructions, I used this option

    =IF(A2″”,IF(AND(B2″”,CELL(“address”)=ADDRESS(ROW(A2),COLUMN(A2))),NOW(),IF(CELL(“address”)ADDRESS(ROW(A2),COLUMN(A2)),B2,NOW())),””)

    Works fine, but after keeping the sheet open for a few hours, while updating it, the timestamp gives an #N/A error and can’t get it back.

    I use the VBA timestamp function to get over this, seems to be working fine…

    Any ideas?

    Thank you

  7. For Timestamp Update Formula:

    =IF(B4″”,IF(AND(F4″”,CELL(“address”)=ADDRESS(ROW(B4),COLUMN(F4))),NOW(),IF(CELL(“address”)ADDRESS(ROW(B4),COLUMN(B4)),F4,NOW())),””)

    Works fine when it is on the same sheet, but its not working for different sheet even after changing the reference all B4 into Sheet1!B4 and looking output in the Sheet 2 in F4 Cell

  8. This has worked perfect for what I was trying to create. I now have the problem of the timestamp resetting each time I reopen the file. Is there a way for the timestamp to stay the same from when the data was put in?

    • Disregard…

  9. Hi

    I need a timestamp on “C” that updates the time when either “A” or “B” is updated. I can’t use a macro as I need my file in Sharepoint and to be accessible by many people at the same time.

    How can I use the circular reference or the Custom Function for this purpose?

    Thanks!

  10. it working fine with me, however i have issue when using auto-filter or Auto-clear-filter function for designated table, it will keep updating the timestamp in all timestamp reference cells…

    below sub :
    ——————————————————————–
    Sub Access_Filter()

    Dim WeekS As String
    Dim WeekE As String

    WeekS = “>=” & Application.InputBox(Prompt:=”Enter Start Date”, Default:=Format(Date, “dd mmm yyyy”), Type:=2)
    WeekE = “<=» & Application.InputBox(Prompt:=»Enter End Date», Default:=Format(Date, «dd mmm yyyy»), Type:=2)

    ActiveSheet.ListObjects(«ACCESS»).Range.AutoFilter Field:=3, Criteria1:=WeekS, Operator:=xlAnd, Criteria2:=WeekE

    End Sub
    ———————————————————————————-
    Sub Access_Clear_All_Filters_Range()

    ‘To Clear All Fitlers use the ShowAllData method for
    ‘for the sheet. Add error handling to bypass error if
    ‘no filters are applied. Does not work for Tables.
    On Error Resume Next
    ActiveSheet.ListObjects(«ACCESS»).Range.AutoFilter Field:=3
    On Error GoTo 0
    ActiveSheet.ListObjects(«ACCESS»).Range.End(xlDown).Select

    End Sub

    • I am having this issue too. I am using it in a table and every time i change filters, it updates to the current time.

  11. Great job thanks!

  12. How to put an start date and time with end date and time? Same as above with duration.

  13. Hi guys, I tried to apply the formula below. It works and i saved my macro excel. But when I opened my file (1st time after the file created) the macro was put to disable. when i enable it then the timestamp reset. It also happened when the file was opened from other user which using the same network folder. any idea how to prevent the timestamp reset?

    Function Timestamp(Reference As Range)
    If Reference.Value “” Then
    Timestamp = Format(Now, “dd-mm-yyy hh:mm:ss”)
    Else
    Timestamp = “”
    End If
    End Function

    • Same issue not sure if anyone found a solution.

  14. For the formula
    =IF(A2″”,IF(AND(B2″”,CELL(“address”)=ADDRESS(ROW(A2),COLUMN(A2))),NOW(),IF(CELL(“address”)ADDRESS(ROW(A2),COLUMN(A2)),B2,NOW())),””)

    is it possible to change “A2” to a range of cells?

    • I agree is it possible to add a list of cells that are changed and record the dates the they were changed??

  15. For the formula
    =IF(A2″”,IF(AND(B2″”,CELL(“address”)=ADDRESS(ROW(A2),COLUMN(A2))),NOW(),IF(CELL(“address”)ADDRESS(ROW(A2),COLUMN(A2)),B2,NOW())),””)

    is it possible to change “A2” to a range of cells?
    I would like to use “A2:M2” as the affected cells, so the timestamp updates when any one of that range of cells is modified. I tried to change it but it would not work.
    I added another set of parentheses to each A2:M2 range, still no luck.

    • H i Ron, I had the same problem and fixed it by adding an OR within the AND expression like:

      In an example field C2 is also ‘monitored’ for change.
      It is a formula mess but it works.

      =IF(A2″”,IF(AND(B2″”,OR(CELL(“address”)=ADDRESS(ROW(A2),COLUMN(A2)),CELL(“address”)=ADDRESS(ROW(C2),COLUMN(C2)))),NOW(),IF(CELL(“address”)ADDRESS(ROW(A2),COLUMN(A2)),B2,NOW())),””)

  16. Hi Guys i’m looking for something similar the point of difference is as follows … eg There is a column A which is part of a table where it records a series of values based on a formula. values are “text 1″,”text2″ text3” etc . What i want is in column b, should the value in corresponding Acell reaches “text3” then it records the date when the cell reached “Text 3” else blank. Can anyone help…

  17. excellent!

  18. Hi, Sumit.Greetings!!
    I’m preparing a worksheet to enter all the received purchase orders & associated details viz. customer name, item type, item drawing no., drawing revision no. in po, etc. Say BOOK1
    When all the relevant data is entered then I get ” found-clear” in column O & now all the data related to that entry is to be extracted to another book, say BOOK-2.
    Also extracted data should appear in BOOK-2 in a sequential manner, without blank rows & as any entry is cleared in BOOK-1(PO entry workbook), it should appear in BOOK-2 below all the previously extracted entries.

    To solve this, I thought of getting :
    1) Fixed, non-volatile timestamps as soon as ” found-clear” appears in column O for any PO entry.
    2) To give Rank to these timestamps, using Rank Function.
    3) Then use Index, Match, Rows to extract data in a sequential sorted manner.

    To get fixed( non-volatile) timestamps I applied two approaches as shown by you:
    1) Circular reference with NOW()
    2) UDF

    I’ve attached an excel file with two sheets:
    1) Examples
    2) Application

    Problem 1) with circular reference & NOW()

    1A) Also if I change conditions so that “found-clear” is removed & then recreate the conditions to get “found-clear” back, timestamp disappears.

    Problem 2) with UDF; refer sheet” examples”, SAMPLE-3
    2A) It is showing the year as 1989 in place of 2019.
    2B) If I make any changes to the worksheet, like add or remove cells anywhere in the worksheet, all the timestamps change to current time & date.
    2C) Rank function not working.

  19. Guys,

    I have a different requirement and this is for stock market.

    Let us say I have Columns A to G in the excel sheet and the columns heading reading as below for stock market :

    Symbol, Lot Size, Open, High, Low, LTP and the Signal Column (which gives Buy or Sell based on a strategy).

    The last column which is the Signal Column (and which happens to be Column G) contains the “Buy”or “Sell” or Ëmpty when there is no signal. This column is dynamic, in the sense, as and when the data across A-F changes, I get new signals like Buy or Sell or Empty, depending upon the strategy.

    My expectation is, as and when I get a Buy or a Sell or an empty in Column G (in the event of a Buy and Sell that has changed to an empty cell), I want to timestamp, let us say, Column H with the exact time the change happened (regardless of Buy or Sell or empty (post a buy or sell). And this timestamp should not change the time, unless any change happens in Column G. For e.g. a buy changing to a sell or a sell changing to a buy or a buy/sell changing to an empty cell.

    Let me know if the above explanation helps.

    • The challenge I have with the available solution on the net is, my Excel sheet refreshes every 1 minute pulling data off the net, and as and when it does, the timestamp changes to the current time as against the time the signal came.
      For e.g. a BUY or SELL that came at say 11:15 AM, should remain static unless the signal changes from a buy to sell or a sell to buy, but everytime my excel refreshes it updates with the current time in this column. What I am looking for is to understand what time a buy or sell came.

  20. I used this formula yesterday on 5th March and it worked perfect =IF(A2″”,IF(B2″”,B2,NOW()),””) my dates registered as 5th March timestamp. However I’ve now come into the same spreadsheet the very next day on 6th March but when i enter data into column A new rows, the formula in column B remains blank no result. Is there another step I’ve missed so it recognises a new day?

  21. Super easy directions – thankyou 🙂

  22. This has been really helpful! thank you! I was wondering if we’re able to input in multiple cells (e.g. A2, B2, D2) and still get and updated timestamp in “F2” when ever the multiple cells (A2, B2, D2) are updated.

  23. It worked on one Excel Spreadsheet but when I tried it again on another Spreadsheet (totally different workbook), it just shows a blank cell. I have it formatted for date.

  24. In the example, “Using VBA to Automatically Insert Timestamp in Excel” I have a condition where a process is running and I want to ‘time stamp’ when it began in one column and ‘time stamp’ (date and time) when the process ended, a few columns to the right…meaning a start and stop time stamp. Can this formula accommodate this requirement?

  25. Hi,

    Thanks Sumit, very nice contribution 🙂

    To add to your article for those, who like to have a static value for Date or Time Stamp and need a specific date / time format but without going through VBA, you may consider this option:

    1. Choose one Reference Cell, e.g. [A1]. It can be on a separate worksheet.

    Put in the formula
    =today()
    or
    =now()

    2. Give that cell the name “Time” or “Date”

    3. Now, if you want to enter current Date or Time in any cell in your workbook, just type

    =Date
    or
    =Time

    The target cell can be formatted according to your preferences, e.g. “YYYY-MM-DD” or “hh:mm:ss”. The advantage is that you can also catch the seconds which is not possible with the keyboard shortcut [CTRL] + [SHIFT] + [:].

    4. You can also incorporate this in any formulas you are using in your worksheet.

    Example:

    Every time you enter the word “ok” in Row [C], Row [B] will automatically register the current time. To do this format Row [B] as “hh:mm:ss”.
    Now, in cell [B1] you enter the formula

    if(C1=”ok”,Time,””)

    Then you copy this formula to the range you will be using.

    Now, every time you enter “ok” in a cell on Row [C], you will get an automatic (and static) time stamp in the adjacent cell in Row [B].

  26. NICE great article style and super helpful

  27. I’m trying to create a timestamp based on a dropdown value, however leveraging the macro is providing a validation error. Is there a workaround? If I use in a blank (no validation field) the vba/macro works correctly.

  28. Function Timestamp(Reference As Range)
    If Reference.Value “” Then
    Timestamp = Format(Now, “dd-mm-yyy hh:mm:ss”)
    Else
    Timestamp = “”
    End If
    End Function

    is not worjking ???

    • there is a typo in the formula,
      replace -yyy by -yyyy (4 letters) and it will work.

  29. Hi there – this is FABULOUS! Really saved me a lot of pain!

    Can you assist with one thing?

    I need to be able to create the timestamp, on a separate row, each time a (custom function) button is pressed?

    We will be using this to create a basic “footfall counter” to count the time/date and number of people passing into our IT support area.

    If you can assist, this would be amazing…

  30. Thank you for your tips! I am an italian Excel Professionist and often i read your blog. Good work 😉 Marck

  31. Is it possible to write a code that take effect of Cell A or Cell B for the timestamp?

    using below code:
    Function Timestamp(Reference As Range)
    If Reference.Value <> “” Then
    Timestamp = Format(Now, “dd-mm-yyy hh:mm:ss”)
    Else
    Timestamp = “”
    End If
    End Function

    In cell C, should I use =timestamp(A1:B2)

  32. This is just what I needed. You rock!
    Thank you!

  33. =IF($A12<>“”,IF(AND($I12<>“”,CELL(“address”)=ADDRESS(ROW($A12),COLUMN($A12))),NOW(),IF(CELL(“address”)<>ADDRESS(ROW($A12),COLUMN($A12)),$I12,NOW())),””)

    i CHECKED FOR ITERATION ALSO.. EVEN ITS NOT WORKING KINDLY HELP ON THIS

  34. NOT WORKING SECOND FORMULA

  35. I use the following formula (=IF(A2″”,IF(B2″”,B2,NOW()),””)
    But whenever i type in other cells, the time updated.
    or when i save and close, then reopen the date and time updated automatically.

  36. Superb Job.Thanks

  37. Can the custom function be modified to display hh:mm then am or pm?

  38. Wowww This is what I am looking for!!!

    THANK YOU SO MUCHHH!!!!

  39. One issue: keeping the formula options for iterations to prevent the cirucular reference error. The options are not saved with the sheet. They are saved on the computer and those saved options change with each workbook you open. For a timestamp with a circular reference you need to set the options as the workbook opens. Use this macro:

    Private Sub Workbook_Open()
    Application.Calculation = xlCalculationAutomatic
    Application.Iteration = True
    Application.MaxIterations = 1
    End Sub

    That solves the problem and the formula works fine every time.

  40. Why =IF($A$1″”,NOW()) does not work here.

  41. grate! just you should say that it works mailny or totaly only on ENG versions.
    I have Excel in italian and many of this stuff does not work like that

  42. I have checked ‘enable iterative calculation’ option and I have put the formula =IF(A2””,IF(B2””,B2,NOW()),””) in cell B2 but I am getting error #Name? when I enter any text in A2.

    • Hello Sajid.. Your double quotes are not in the right format (it happens sometimes when copied directly from the webpage). Just delete the double quotes and enter it manually. It would work then.

      • Yes, Now it’s working. Thank you so much Sumit.

  43. I like the automated timestamp, I have users who have asked for similar things, it gives ideas on how to implement.

  44. Thanks Sumit……..I was searching this for more over decade.

    • Glad you found this useful Anand!

  45. When I tried to use the formulas to insert the timestamp, it returned 1/0/1900. It sounds like some setting that needs to changed but I couldn’t figure out where or what to change.

    • Hello Terry.. You need to check the ‘enable iterative calculation’ option for this to work

      • How to make it work for an online excel sheet shared with multiple people?

  46. Good one! thanks

    • Thanks Ashesh!

  47. Excellent tip! Thank you!

    • Thanks for commenting.. Glad you liked it 🙂

Comments are closed.

Do you need to insert a timestamp in Excel? This question is one of THE most requests I receive on a regular basis. Although there is no built-in function or process in Excel to insert a timestamp, it is possible to create a timestamp in Excel with formulas and a little tweek to iteration settings in Excel. But more about that later. This article will walk you through the formula to create a timestamp in your Excel worksheets along with a simple-to-follow example. Lets get started!.

When working in Excel under a lot of circumstances, entering dates in Excel is a straightforward process. For example, dates are entered for invoices or a project plan, this would normally be carried out manually. This is very slow and manual, There is a much more efficient way to achieve an excel timestamp.

Ways To Enter Date And Times Into Excel.

There a a few ways to enter dates and times into Excel. I differentiate these from the automatic timestamps. But, to understand the differences in these methods is important. So here are the two ways users normally attempt to enter date and time into Excel. Both of these functions are known as volatile functions. These types of function recalculate every time there is an update in the Excel workbook. This is an important point in this solution.

The NOW Function To Enter Date And Time

The NOW() function in Excel will enter the current date and time from your system clock. The syntax is easy. Type =NOW() and hit enter. It is important to note that Excel stores date and times as numbers, so ensure that your cell formatting is correct to display date and time.

now function excel timestamp
  • Right click on your cells
  • Select Format cells
  • In the dialogue box select “dd-mm-yyyy hh:mm:ss”
  • Hit Ok.

As already stated above this function is known as a volatile function. This means that Excel recalculates this function every time there is a change in the workbook. So, just because your enter the NOW() function at the current date and time, it WILL change when the workbook updates. So, as you can see this is probably not the solution to timestamp your Excel workbook.

The TODAY Function To Enter Date Into Excel.

The TODAY() function in Excel will enter the current date inot your Excel worksheet from your system clock. The syntax is easy. Type =TODAY() and hit enter. It is important to note that Excel stores date and times as numbers, so ensure that your cell formatting is correct to display date.

  • Right click on your cells
  • Select Format cells
  • In the dialogue box select “dd-mm-yyyy”
  • Hit Ok.

Again, this is a volatile function recalculating everytime Excel updates. This function in will also not give the desired Excel timestamp in Excel.

today function in Excel

Using Excel Shortcuts To Insert Date And Time

Ok, so we cannot really use and Excel function currently to create a timestamp in Excel. We can however use a very manual process. Thee are tow shortcuts that insert the current date and the current time. These two shortucts do create a timestamp which is not volatile. however, the process is very manually and the user physically has to insert these shortcuts rather than the timedtamo happening automatically.

here are the shortcuts to try.

  • CTRL+ ; to enter the current date or
  • CTRL+SHIFT+: to enter the current time

The Solution.

Now, the solution most of my questions refer to is that of entering data into one cell in excel, and a timestamp appearing in another. For example a login sheet, or date entry sheet, login the date and time users entered data. So, there is a way to do this, using formulas but with a little Excel trickery or magic and an understanding of Circular References. Let’s get started.

Circular References Explained.

You may have come across them before, but if not, here’s a quick rundown circular references. A circular reference refers back to itself either directly or indirectly. Here is an example.

If I type =A4+1 in cell A4, I directly refer to the cell containing the formula. The consequence would be a warning from Excel if you did not create this circular reference intentionally. This example of an is intentional, and the result of the formula is zero.

Excel timestamp circular reference

If I type 2 into cell A1, then type =A1 into cell A2, then A2 refers back to A1 and gives a result of 2. So the result is a regular formula.

normal Excel formula

If I go back to cell A1 and enter the formula =A2+3, this will create a circular formula. I base the formula in A2 on A1, and I am writing the formula in A1. Essentially, the formula is referring to itself. See how this works?.

Excel circular reference with timestamp

You can see above that Excel indicates the circular reference with a blue vertical line after selecting OK to its warning. So, let’s take this a step further.

Excel Iteration Settings.

There is a setting in called ‘iterations’ in Excel. This setting controls how many times a formula recalculates. Without this setting, calculations would go into an infinite loop and eventually stall. By default, this setting is switched off in Excel.

So, this is the reason when you type a circular reference, Excel throws you a warning. It stops and doesn’t calculate the formula as it could run infinitely. Simply follow the steps below to change the iteration settings to control how Excel formulas calculate. Take a look for yourself.

  • Excel Options.
  • Formulas.
  • Calculation Pettlings
  • Select enable iterative calculation
  • Change the default setting to 1. Recalculation will happen once before it stops.

Excel timestamp In Excel

Consequently, in our case, this will result in cell reference A1= 5

So, to insert a timestamp in Excel, we can exploit this circular referencing and iteration to our full advantage. We base the timestamp process on the above theory of iteration.

Type the following formula into cell A1

=IF(B1<>””,IF(A1=””,NOW(),A1),””)

Then type something into B1. The data and time is stamped into the cell. Drag the formula in Column A down to allow time to stamp all the way down the column.

How The Excel Timestamp Works.

The formula is checking cell B1, and if it is not empty, it runs the circular formula =IF(A1=””,NOW(),A1), which returns the NOW() function. If A1 does not already have a value. Excel inserts the timestamp.
So, why not go ahead and give this a go. Let me know if you have any other way of creating a timestamp in Excel?

Excel Macro

See all How-To Articles

This tutorial demonstrates how to insert a timestamp in Excel and Google Sheets.

Timestamp Intro

There are several ways to insert a date and/or time into Excel, depending on what you want the timestamp to record and whether you want the data to update automatically when Excel is opened (to the current date and/or time).

Create a Dynamic Timestamp

A dynamic timestamp changes each time you open the Excel file. There are two functions that can be used to do this: the NOW and TODAY Functions.

The NOW Function

The NOW Function puts the current date and time into your Excel file.

Select the cell where you wish the date and time to show and type:

=NOW()

TimestampNow
Then press ENTER.

The TODAY Function

The TODAY Function puts the current date into your Excel file.

Select the cell where you wish the date to show and type:

=TODAY()

Timestamp Today

Then press ENTER.

Note: You need empty parentheses at the end of both NOW and TODAY; they are Excel functions that do not take any arguments.

Create a Static Timestamp

Entering a static timestamp into Excel means that when the file is next opened, the date and/or time does not update.

  • To insert the current date into a cell, select the cell where you wish the date to go. Using the keyboard, press and hold the CTRL key and press the semicolon (;) key.
  • To insert the current time into a cell, select the cell where you wish the date to go. Using the keyboard, press and hold SHIFT and CTRL and press semicolon (;). (Shift-semicolon is the same as a colon.)
  • To insert the current date and time into a cell, select the cell where you want the date and time to go. First, insert the date using CTRL + ;. Then, click in the formula bar to insert the time using CTRL + SHIFT + ; and press ENTER.

Timestamp Static

While the date and time both show in the formula bar, the cell itself is only formatted to show the date.

To format the cell to show the date and time, in the Ribbon, select Home > Number > Custom.

Timestamp CustomFormat

Type in the format you want and click OK.

Create a Timestamp with VBA

You can also insert a timestamp in Excel using VBA code.

The code below inserts a dynamic timestamp into the selected cell.

Sub InsertDynamicTimeStamp
   Activecell = "=Now()"
End Sub

The code below inserts a static timestamp into the selected cell.

Sub InsertStaticTimeStamp
   Activecell = Now()
End Sub

Note: When using VBA to insert a dynamic timestamp, the NOW Function including an equal sign needs to be contained within quotation marks, as the actual function is inserted into the Excel cell. The static timestamp uses the VBA NOW() function to insert the value into the selected cell.

Insert Timestamp in Google Sheets

You can also use the NOW and TODAY Functions to insert dynamic timestamps into your Google sheet.

Timestamp gs now

For static timestamps, you can also use CTRL + ; and CTRL + : to insert the date or time. However, Google Sheets has a keyboard shortcut that Excel doesn’t – CTRL + ALT + SHIFT + ; (Control-Alt-Shift-semicolon). This inserts a static date and time into the selected cell.

Timestamp gs static

The Date and Timestamp is a type of data type that determines the date and time of a particular region. It contains some characters along with some encoded data. This format may vary from language to language. Keeping track of date and time helps in managing records of our work as well as segregate the information day-wise. In this article, we will be going to learn how we can automatically insert Date and Timestamp in Excel.

There are multiple ways to insert Date and Timestamp in Excel. These methods include both static and dynamic methods.

1. Inserting Date And Timestamp using keyboard shortcuts (Static method)

The static method is helpful when there are only a few cells where you need to insert the Date and Timestamp. You can quickly use the keyboard shortcut to manually insert the Date and Timestamp.

Follow the below steps to implement the same:

  • Select the cell into which the current date or time needs to be inserted.
  • Use this shortcut – Ctrl + ; (Control + semicolon) to insert the current date.
  • Use this shortcut – Ctrl + Shift + ; (Control + Shift + semicolon) to insert the current time.
  • Use this shortcut – Press the combination (Ctrl + ;) and (Ctrl + Shift + ;) to insert the current time and time.

2. Inserting Date And Timestamp using  Formulas:

The NOW() and TODAY() functions can be used to insert the current date and time that will update automatically. This method dynamically updates the date-time whenever a change is made in the worksheet.

  1. NOW(): To insert current date and time.
  2. TODAY(): To insert the current date.

Follow the below steps to implement the same:

  • Select the cell into which the current date or time needs to be inserted.
  • Enter the function NOW() or TODAY().
  • Press the Enter key.
  • The current date-time or date will be inserted into the selected cell.

3. Insert Timestamp Automatically While Entering Data In Different Column

This method will enable the insertion of the timestamp in a column while entering data into another column. For example, consider two columns A and B in your worksheet. While you enter data in a cell of column A, the current date and time in the corresponding cell in Column B will get updated automatically.

Follow the below steps to implement the same:

  • Click File -> Options and the Excel Options dialogue box will appear. Now from the left pane, select the Formulas option. You will see Enable interactive calculation in the right pane below Calculation options. Check this option and select OK.

  • In this next adjoining column (say column B), enter this formula: 
=IF(A1<>"",IF(B1<>"",B1,NOW()),"")
  • Drag and select cells to auto-fill the formula.

  • You can also customize the format of the date and time. To do this, right-click on the selected formula cells, go to the context menu, and select Format Cells. You will see the Format cells dialogue box. Go to the bottom and select Custom. In the right pane select the suitable format for your cells.

  • Now when you enter the data in a column, you will get the date and time in your chosen format in the adjoining cell.

4. Using VBA To Insert Timestamp Automatically While Entering Data In a Different Column

If you are familiar with working on VBA, then there is another method for you to automatically insert the timestamp in your excel sheet using VBA.

Follow the below steps to implement the same:

  • To open Microsoft Visual Basic for Applications, press Alt + F11. The VBA window will open. Now go to Insert and select the Module to open a blank module.

  • Now, add the code given below to your blank module and save the code.
Function MyTimestamp(Reference As Range)

If Reference.Value <> "" Then

MyTimestamp = Format(Now, "dd-mm-yyyy hh:mm:ss")

Else

MyTimestamp = ""

End If

End Function

  • Go back to your worksheet and type the below formula in your cell in which you want to insert timestamp.
A is the column for inserting entries of data.
B is corresponding column, into which the date and timestamp will be updated.

Type the below formula into B1 cell:
=MyTimestamp(A1)

  • Now, if you insert the entry in a column, you will get the date and time in the adjoining cell automatically.

Понравилась статья? Поделить с друзьями:
  • Time sheets in word
  • Time plan in excel
  • Time out one word or two
  • Time order word list
  • Time order word games