Back to articles
Time and Date
2024-01-0211 min read
#date#shortcuts#time#timestamp

How to Insert a Timestamp in Excel: Static, Dynamic, and Automatic Methods

Functions in this article

Jump to the reference pages for the Excel functions used below.

Browse library

To insert a timestamp in Excel, use a keyboard shortcut for a fixed date and time, or enter =NOW() for a value that changes when Excel recalculates. To record when you fill another cell, you need an automatic method, such as a worksheet VBA event or an iterative formula with some limitations.

Suppose you enter a task in A2 at 9:15 AM and want B2 to record that moment. Tomorrow's date and time won't help you remember when you entered it. Decide whether you need a fixed record or the current time before choosing a method.

What you needMethodWhat happens later
A date and time you insert yourselfKeyboard shortcutsThe stored value stays fixed unless edited
The current date and time=NOW()Updates on recalculation
The current date only=TODAY()Updates on recalculation
A first-entry stamp without VBAIterative IF/NOW formulaTries to retain its result while the input remains filled; requires controlled setup
An automatic first-entry stamp in desktop ExcelWorksheet VBA eventWrites a value and preserves it on later input edits
A last-modified stampAdapt the VBA event belowReplaces the value on each qualifying input edit

You can download the timestamp example workbook to compare fixed values and formulas. It's an .xlsx file; the VBA example below must be added separately to a macro-enabled workbook.

Insert a fixed timestamp with a keyboard shortcut

Enter your task in A2, then select B2. Use the shortcuts for your desktop version of Excel:

InsertWindowsMac
Current dateCtrl + ;Control + ;
Current timeCtrl + Shift + ;Command + ;
Date and time togetherCtrl + ;, then Space, then Ctrl + Shift + ;Control + ;, then Space, then Command + ;

For the combined timestamp, complete the sequence in the same cell before pressing Enter. B2 now contains a value, so recalculating or reopening the workbook won't update it.

Microsoft's date and time entry instructions cover these Windows and Mac shortcuts, including Microsoft 365, Excel 2024, and Excel 2021. In Excel for the web, you can type a fixed date and time directly and apply a date/time format.

Show the date and time clearly

Right-click B2, choose Format Cells, and select Custom on the Number tab. For an English-language Excel example, use:

yyyy-mm-dd hh:mm:ss

A value representing September 25, 2026 at 9:15 AM would display as 2026-09-25 09:15:00. Formatting controls what you see; it doesn't make a changing formula static or add precision that wasn't captured. Widen column B if the result displays as #####.

Use NOW or TODAY for a changing value

On a separate practice sheet, enter your task in A2 and put this formula in B2:

=NOW()

The NOW function returns the current date and time when Excel calculates it. If the worksheet calculates at 9:15 AM, that is the time you see; a calculation at 9:20 AM can replace it with 9:20 AM. It doesn't remember when you entered A2.

For the date alone, enter this in C2 and apply a date format:

=TODAY()

The TODAY function has no time component. Both functions take no arguments, so leave the parentheses empty.

These formulas aren't ticking clocks. Microsoft documents that NOW updates when the worksheet calculates, rather than continuously. Calculation settings matter: if the displayed value seems old, check Formulas > Calculation Options and recalculate the workbook.

Freeze a formula result manually

To keep the currently calculated value in B2, copy B2 and use Home > Paste > Values on the same cell. The formula is replaced by its value. Check the formula bar: it should show a date/time value instead of =NOW().

This records the value present when you copy it. It cannot recover the earlier time when you entered the task in A2.

Create a first-entry timestamp with an iterative formula

A normal formula calculates a result; it doesn't keep a history of earlier results. The following workaround makes B2 refer to itself so it can reuse its previous value. That creates a circular reference, which Excel normally warns about.

Use a separate practice sheet with Task in A1 and Entered at in B1. Start with A2 empty. Don't combine this method with the VBA method on the same sheet.

  1. Enable iterative calculation in desktop Excel. On Windows, go to File > Options > Formulas > Enable iterative calculation. On Mac, go to Excel > Preferences > Calculation > Use iterative calculation.
  2. Enter this formula in B2 while A2 is still empty:
=IF(A2<>"",IF(B2="",NOW(),B2),"")
  1. Format B2 as yyyy-mm-dd hh:mm:ss and let the worksheet calculate. B2 should appear blank.
  2. Enter a task such as Send invoice in A2 and let Excel calculate again. The intended result is a timestamp in B2.
  3. Edit the task text without clearing A2. Check that B2 retains its earlier value.

The outer IF function checks A2. If A2 is empty, the formula returns "", which displays as blank. Otherwise, the inner IF checks the previous result in B2: when it's empty, use NOW; when it already holds a timestamp, reuse B2.

Yes, B2 appears inside its own formula. That's the mechanism, and also the catch. Read the circular reference guide before enabling iteration in a workbook with other formulas. Microsoft's calculation settings guidance also notes that changing desktop calculation options affects all open workbooks.

Clearing, copying, and reopening need care

The formula's intended reset behavior is to return blank when you clear A2 and allow a calculation to occur. Entering a new task after that should start a new timestamp. Clearing and immediately refilling A2 without an intervening calculation can leave the earlier result in place.

To set up more rows, copy B2 down while their column A cells are empty. Check that B3 refers to A3 and B3, then try one row before filling the rest. Deleting B2 removes the formula itself; to restore it, clear A2, re-enter the formula in B2, and calculate before entering new data.

Treat this as a controlled workaround, not a guaranteed permanent record. Test clearing and re-entry, copying, saving and reopening, and calculation-setting changes in the Excel version where the file will be used. A zero or unexpected date is a reason to inspect the setup, not evidence that the entry time was captured. Use desktop Excel for these setup instructions; don't assume the same behavior across web, mobile, and desktop apps.

If you need a value that survives recalculation without depending on a circular formula, use a shortcut, paste the result as a value, or use the VBA method below.

Add an automatic timestamp when data is entered with VBA

A worksheet event can write a fixed timestamp into B when you type or paste a task into A. This example watches A2:A1000 and uses the corresponding cells in B2:B1000. Keep column B for the macro's output, and use ordinary, unmerged input cells.

The policy is first-entry: editing an existing task keeps its original stamp. Clearing the input also clears its stamp, so entering a new task afterward records a new time. This is a reusable row log, not a history of every edit.

VBA requires desktop Excel and permission to run macros. Microsoft provides VBA tools in Excel for Mac, including Microsoft 365, Excel 2024, and Excel 2021 for Mac. Excel for the web cannot run VBA macros.

Put the code in the worksheet module

  1. Start on a separate sheet with Task in A1 and Entered at in B1. Leave B2:B1000 empty; don't put timestamp formulas there.
  2. Open Developer > Visual Basic. In the editor, use View > Project Explorer if the workbook list isn't visible.
  3. Expand your workbook and Microsoft Excel Objects, then double-click the worksheet that contains your task list. Paste the code into that sheet's code window, not a standard module. If it already contains a Worksheet_Change procedure, the two routines need to be combined rather than pasted as duplicates.
  4. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm). Return to Excel and allow this workbook's macros to run according to your organization's policy.
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim changedInputs As Range
    Dim inputCell As Range
    Dim stampCell As Range
    Dim eventTime As Date
    Dim eventsWereEnabled As Boolean
    Dim failureMessage As String

    eventsWereEnabled = Application.EnableEvents
    On Error GoTo HandleError

    Set changedInputs = Application.Intersect(Target, Me.Range("A2:A1000"))
    If changedInputs Is Nothing Then Exit Sub

    Application.EnableEvents = False
    eventTime = Now

    For Each inputCell In changedInputs.Cells
        Set stampCell = Me.Cells(inputCell.Row, "B")

        'This example records direct data entry, not formula results.
        If inputCell.HasFormula Then GoTo NextInput
        If IsError(inputCell.Value2) Then GoTo NextInput

        If Len(CStr(inputCell.Value2)) = 0 Then
            stampCell.ClearContents
        ElseIf IsEmpty(stampCell.Value2) And Not stampCell.HasFormula Then
            stampCell.Value = eventTime
            stampCell.NumberFormat = "yyyy-mm-dd hh:mm:ss"
        End If

NextInput:
    Next inputCell

    Application.EnableEvents = eventsWereEnabled
    Exit Sub

HandleError:
    failureMessage = Err.Description
    On Error Resume Next
    Application.EnableEvents = eventsWereEnabled
    MsgBox "Timestamp update stopped: " & failureMessage & vbCrLf & _
           "Check the affected rows before continuing.", vbExclamation
End Sub

The code writes a value, not a NOW formula. It temporarily disables events so its edits in B don't trigger another event, and its error handler restores the previous event setting if an update fails. If a failure occurs partway through a paste, earlier rows may already have changed; the message tells you to check them.

Check the behavior before using it on your list

Try the following on a copy of your workbook:

ActionExpected behavior from this code
Type a task in A2 with B2 emptyB2 receives the current date and time
Replace the text in A2B2 keeps the first timestamp
Paste tasks into A3:A5Each eligible row gets a stamp; one paste uses one captured time
Clear A2B2 is cleared too
Enter a new task in A2 after clearing itB2 receives a new stamp
Edit A1001No stamp is added; it is outside the watched range
Enter a formula in A2The code skips it
Edit the workbook with macros disabledNo automatic timestamp is written

Zero counts as an entry, and a space counts as text. Paste into column A only: pasting over column B can replace existing stamps before the macro inspects them. Likewise, deleting a stamp directly doesn't regenerate it until a qualifying edit in A occurs.

Microsoft's Worksheet.Change documentation explains that the changed range can contain multiple cells and that formula recalculation doesn't trigger this event. The loop handles multiple input cells; it isn't a way to record every change in a formula's result.

Record the latest edit instead of the first entry

For a last-modified stamp, replace this line:

ElseIf IsEmpty(stampCell.Value2) And Not stampCell.HasFormula Then

with:

Else

Now each qualifying nonblank input edit overwrites the corresponding timestamp. Clearing the input still clears the stamp, and formulas and errors are still skipped. This records when the edit event runs; re-entering the same text can also trigger it.

Choose the timestamp you actually need

Use a shortcut for a few fixed entries. Use NOW or TODAY when the current date or time belongs in the calculation. For automatic entry stamps, choose the VBA approach when desktop macros fit your workflow; use the iterative formula only where you've checked its behavior and documented the settings.

Keep the timestamp beside the task when you sort or move the data. A fixed value can still be edited, deleted, or paired with the wrong row, and these methods don't create a tamper-proof audit log. If your next task is measuring the time between two recorded events, see how to calculate hours between two dates and times.

Enjoyed this guide?

Join our newsletter to get the latest Excel tips delivered to your inbox.

You can unsubscribe anytime. See our Privacy Policy.