Datestamps in Excel when a cell value changes

Daniel Checkman 11 Reputation points
2022-12-20T17:21:58.08+00:00

I've already looked up adding datestamps in Excel. Not a problem. I already have a table with data in it. I don't want to display the current date if there is already data in the cell. I only want the datestamp to update when the other cell value changes, but I do want a default date for the unchanged data. So, here is the example,...

Suppose I already have a value of 1000 in cell A2 and a blank in cell A3. I want a default date in cell B2, but if cell A2 changes to 1001, I want the current date in B2. For cell B3, I want it to be a blank until data is entered/updated into B2.

How can this be done?

Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,742 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Ali AlEnezi 1,066 Reputation points
    2022-12-20T17:39:13.323+00:00

    Hi @Daniel Checkman

    To add a datestamp to a cell in Excel when the value in another cell changes, you can use the following formula:

    =IF(A2<>A2, "", TODAY())

    This formula will return a blank value if the value in cell A2 has not changed, and will return the current date if the value in cell A2 has changed. You can then copy and paste this formula into the other cells in column B to apply the same logic to those cells.

    Here's an example of how you could use this formula:

    In cell B2, enter the formula =IF(A2<>A2, "", TODAY()). This formula will return a blank value if the value in cell A2 has not changed, and will return the current date if the value in cell A2 has changed.

    In cell B3, enter the formula =IF(A3<>A3, "", TODAY()). This formula will return a blank value if the value in cell A3 has not changed, and will return the current date if the value in cell A3 has changed.

    Repeat this process for the other cells in column B as needed.

    Good luck!

    2 people found this answer helpful.

  2. Paul 20 Reputation points
    2024-12-17T13:26:41.78+00:00

    Updated solution - have resolved being able to update entries immediately

    For anyone else that is finding macros don't run on a works configured computer my current version of formula for this tweaked to stop it updating on every call of today function from what was previously shared is

    Since the cell references itself in the formula you will need to enable file - options - formulas - enable iterative calculation turned on for this formula to work. I've set this to 2 iterations which is working so far.

    When configuring this for your own table Column G contains the Data being monitored and Column H is the column containing the formula below where date is shown. Column I is a comparison field this column can be resized / hidden from the user

    This formula gives todays date for any cell you enter/update data or returns a default date of 1st Jan 1901 if data was already present the day you entered the formula. you can change this by altering the number 367 to the number associated to whatever date you would like to show. The number 45643 is the value returned by the =today() command - this should be set to whatever number is returned the day you add this formula to your spreadsheet.

    the text function sets the date formatting into readable format and removes need to configure this in formatting. It also I believe will override any formatting set elsewhere using the format command that may otherwise break the formula comparisons if changed.

    Formula in column I

    =IF(G4="","",IF(H4=(TEXT(367,"DDD DD MMM YYYY")),G4,IF(H4=(TEXT(TODAY(),"DDD DD MMM YYYY")),G4,I4)))

    Formula in column H

    =IF(G4<>"",IF(H4<>"",IF(G4<>I4,(TEXT(TODAY(),"DDD DD MMM YYYY")),H4),IF(TODAY()=45643,(TEXT(367,"DDD DD MMM YYYY")),(TEXT(TODAY(),"DDD DD MMM YYYY")))),"")

    Recommended typing these formulas out in a row with no data for cell being monitored and then use the fill function on comparison column first then date column to avoid incorrect results showing

    When you add data on the day you fill out the formula to get todays date to show making any second change will trigger todays date instead of default old data date value being shown

    Again thanks to all the other contributors - without the hints and tips they've shared this solution wouldn't exist

    1 person found this answer helpful.

  3. Cimjet 81 Reputation points
    2022-12-22T21:19:41.863+00:00

    Hi Daniel
    I can do what you want if you compare column A to another column. It can be in the same sheet or another sheet
    eg:
    Column A Your Data, then copy your Data to Column E
    This way if you change anything in column A the macro will detect the difference between the two columns and stamp date and time in column B.
    This is a sample Macro that compairs column A with Column E
    Try it in a test worksheet and see if that will work for you.
    You may need to format your date and time.
    This is an Event Macro, it goes in the Worksheet not in a Module but We can change it if you like.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim cel As Variant, LastRow As Long
    LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
    For Each cel In Range("A2:A" & LastRow)
    If cel.Value <> cel.Offset(0, 5) Then
    cel.Offset(0, 1) = Now
    End If
    Next cel
    End Sub

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.