Add the Current Date When Data is Added to a Cell(Dynamic) – Google Sheets

Google Apps Script: NOW, TODAY

A colleague of mine had recently asked me if there was a way to automatically display the day’s date when a cell has data in it without having to use Google Apps Script.

My answer: “Why yes, there is Jim.”

There are two really cool tools that you can use in Google Sheets to get the current date or time and date:

The NOW formula provides a date and time stamp at the time of execution or when the NOW() function is entered into the sheet.

NOW Google Sheets

The TODAY formula provides just the date at the time of execution or when the TODAY() formula is entered into the sheet.

TODAY Google Sheets

Change the date when a cell is edited

That’s all well and good but I want this formula to occur when a user enters something in a cell.

Done:

To achieve this, we can use an IF statement. First, we will state if the cell is empty, then no date should appear. However, if the cell has a value in it, then the date and/or time the value was entered will appear in the corresponding cell.

Here’s the formula:

=IF(A2 ="", "", TODAY())  <<Formula is celll D2

ِAs you can see in the  IF statement we are saying; if there is nothing in cell A2 then don’t do anything, otherwise, if it contains a value then add today’s date in this cell, D2.

Now, if you want to have this ready for all rows for when a user adds to your data, then drag the formula all the way down to the bottom of the sheet.

Here is an example:

IF value DATE Google Sheets

Ready to add some data? Here is what is would look like:

Current Date Added When Cell is Entered

The NOW() and TODAY() functions are Dynamic. This means that they will update automatically. To keep these dates from changing, copy the cell and press <CTRL>+<SHIFT>+<V> or paste special> paste as value.

A Warning on NOW() and TODAY()

These two functions are Dynamic and will update constantly. If you are looking to get the date or time of something so that it does not update automatically then check out this tutorial :

Add the Current Date to a Sheet When Data Is Added So That The Date Does Not Change(Static) – Google Sheets

Give it a try.

Did you enjoy the tutorial? Want to upskill and get a solid step-by-step course to become a pro at Google Sheets? Check out my course, Google Sheets: Learn the Essentials with Three Detailed Projects. Sign up today.

 
Google Sheets Shortcuts Mousepad
Google Sheets Shortcuts Mousepad
Want a fast track to boost your Spreadsheet efficiency? Grab one of these handy Google Sheets Shortcuts mousepads that I created from my store.
Google Sheets Shortcuts Mousepad Gel
Google Sheets Shortcuts Mousepad Ge

~Yagi

 

13 thoughts on “Add the Current Date When Data is Added to a Cell(Dynamic) – Google Sheets”

  1. I’m struggling to understand the usefulness of this solution, since the date will change every time you open the sheet or change any cell. If I open the sheet shown above on Wednesday, all the rows with values in column A would have Wednesday’s date in column D (the “Date Sent” column)… Then if I open the sheet again on Thursday, all the dates in column D would change to Thursday. How is this helpful at all for tracking the date that a cell was changed?

    It sounds like the following sentence:

    “…if the cell has a value in it, then the date and/or time THE VALUE WAS ENTERED will appear in the corresponding cell.”

    Would be more accurately stated as:

    “…if the cell has a value in it, then the date and/or time YOU ARE VIEWING THE SHEET will appear in the corresponding cell.”

    1. Hello James,

      I would agree that adding the current date in this example is not ideal. However, when a sheet creator is unable or unwilling to use Google Apps Script to provide a static date, then this is a reasonable alternative so long as they review each day and update the changed values. The colleague mentioned above tutorial would use a sheet they reviewed daily and would get the date they reviewed it along with the difference from the TODAY value and a static deadline. They would then copy and paste as “value” the entire sheet each day to update their sheet. They didn’t want anything more complicated than this. This is what I provided.

      It was interesting enough for me to use it as a lead-in post for: Add the Current Date to a Sheet When Data Is Added So That The Date Does Not Change(Static) – Google Sheets

      Using the dynamic dates NOW and TODAY are most useful as tools for comparing against a static date. I often use them in project management sheets to display a day’s remaining on a project, by subtracting the current date from today. Alternatively, I use it to display the following weeks’ date for a weekly deadline. For example:

      ~Yagi

  2. I’m trying to enter the formula =IF(A2 =””, “”, TODAY()), but it returns as an error. Has this functioned been fazed out?

    1. Hi Eric,

      No, it should work fine. I can’t see an error with your formula. What does your error say?

      ~Yagi

    1. Hi Carme 66,

      I am not sure what is causing this error your case. That should work fine. Have you tried to replicate the error on another Google Sheet?

      Cheers,
      Yagi

    2. Old post I know, but for the benefit of anyone who may encounter this syntax error:
      Use “;” instead of “,”. Probably the comma is reserved for number depending on your locale.

      1. Hi Abbesatty,

        Thanks for pointing out the locale differences. I hadn’t it would influence the formula in that way.

        ~Yagi

  3. actually with the given formula, the date/time will change when data is entered or changed in any cell in the sheet… so the only benefit of the given formula is having an empty date/time when that particular cell is empty.

    1. Both TODAY() and NOW() are incredibly useful when comparing dates and time to the current time. I use them frequently in things like Gantt Charts, and billing sheets.

      Depending on your File > Settings > Calculation > Recalculation options that you have set for your Sheet, these options will change when a change occurs on the sheet, when the sheet it opened, or update at a scheduled interval.

      ~Yagi

  4. Yagi, I’m not able to find any way to do.

    I have scraped data of a specific column from one site with this formula which I found on YouTube.

    =index(ImportHtml(“https://xyz.com/?”,”table”,1),3,1)

    This formula was very good, but the data from this code is updated at 5PM daily.

    That is also not a problem but, I want to put date in the front of this formula and I used =Today(), and it is live date which change after night, but I want my date to change when data on that columns changes that was extracted from ‘xyz’ sites, I don’t want my date to change after 12:00 night, I want it to change to current date when data on ‘xyz’ site changes at 5 PM daily.

    At the end, I want to tell what I’m going to do with this.

    The data I’m getting from a ‘xyz’ site is result (in number) of something like 53, 01, etc and it is public data like stock prices, so it is not unothorised copy. They publish it daily at 5pm and change on next day at 5pm, and they show the publish date above the table which I don’t know how to extract, which changes every 5pm when they change the result.

    It might need some complex code, so to avoid it I’m using =today() to make my viewers know that this result is of today’s date not old.

    But, this is problem as they publish eg, 20/01/2022 – 53 and it will continue to show this on site until 5 pm of (NEXT DAY) 21/01/2022. But on my sheets as I’m using =today() , it will start showing 21/01/2022 – 53, just after 12:00. Which is a wrong Result.

    What is solution?
    1. Any way to change date at 5PM, Any code?
    2. Or if not then any way to make Result hideable like it will show ** untill 5 pm, after 5pm it will show real Result and then after few hours it will disappear and start showing **.

    Lastly, it is a request, I’m a political science student and I know nothing of this technology or coding, so please keep it simple as you can, so
    I can do it easily.

    1. Hi Jassi,

      TODAY is really helpful when you want to compare dates added to a cell against the current date for things like time remaining or deadlines.

      The only way you will be able to achieve this result in Google Sheets is will a little Google Apps Script and is quite a bit beyond the scope of this post.

      If you are interested in giving it a try on your own, I would suggest that you take a look at using time triggers and using the UrlFetch class to check the last updated change and extract the data and add it to your Google Sheet.

      Alternatively, if you don’t think you will have a chance to work on the code, I would recommend hiring a developer on Fiverr. Here is a link directly to the Google Apps Script Developers. One is an affiliate link that gives me a little money to help run the site and the other is a direct link. Both cost the same. You can even share the developer a link to this tutorial to help them out.
      Fiverr (My affiliate link)
      Fiverr

Leave a Reply

%d bloggers like this: