Do not refresh date in IF Statement using TODAY()

0

0

I'm using Excel 2010 and I would like to get the current date using an IF statement that does NOT refresh each time the worksheet is opened. Is there a way to do this with IF or is there another function?

Kimberly Meyers

Posted 2018-09-17T05:21:01.023

Reputation: 1

With built in functions there is no way to do it. You could however create a little bit of VBA code that would compare the contents of a cell on opening the worksheet. If the cell is blank, it can insert the date. If the cell is not blank nothing happens. – Forward Ed – 2018-09-17T21:03:33.747

Answers

5

No. The point of TODAY() is to get the date of the latest recalculation. IF or any other functions won't help either because there's no function that stores the time it was first called and always returns that value

If you need to insert the current date without changing then you shouldn't use a function, instead insert it statically with Ctrl+; (semicolon). Similarly to insert NOW() without changing, use Ctrl+: (colon)

Insert a static date or time into an Excel cell

A static value in a worksheet is one that doesn’t change when the worksheet is recalculated or opened. When you press a key combination such as Ctrl+; to insert the current date in a cell, Excel “takes a snapshot” of the current date and then inserts the date in the cell. Because that cell’s value doesn’t change, it’s considered static.

Insert a date or time whose value is updated

A date or time that updates when the worksheet is recalculated or the workbook is opened is considered “dynamic” instead of static. In a worksheet, the most common way to return a dynamic date or time in a cell is by using a worksheet function.

To insert the current date or time so that it is updatable, use the TODAY and NOW functions, as shown in the following example. For more information about how to use these functions, see TODAY function and NOW function.

Insert the current date and time in a cell

phuclv

Posted 2018-09-17T05:21:01.023

Reputation: 14 930

Aww man you beat me to the punch! good work! – angelofdev – 2018-09-17T05:26:41.860

Wow. Nice to know. And much cleared than the documentation you linked you. That includes the + key and then it starts shifting cells. Without + (as is clear in your answer which uses the kbd tag) it just works. – Hennes – 2018-09-17T05:49:08.067

Sorry if you thought my question was stupid. Is there another function to use ? We are trying to eliminate keystrokes ? – Kimberly Meyers – 2018-09-17T05:50:32.297

Uhm, given the timing. Is that a reply to me ot to phuclv? – Hennes – 2018-09-17T05:55:34.837

I am just trying to find a solution. The tone of PHUCLV's comment seemed un-necessary. If I knew the answer I would not be asking the questions. I did ask if there was another function to use. Thank you for your help. – Kimberly Meyers – 2018-09-17T05:59:48.780

1@KimberlyMeyers I think you're reading too much into it. Phuclv was just explaining how exactly the TODAY() function works, an alternative as he mentions is the NOW() function. You could try putting the required date into a cell and referencing that instead of TODAY(), otherwise I don't believe you can accomplish what you're requiring specifically without using some VBA. – angelofdev – 2018-09-17T06:43:17.327

@KimberlyMeyers sorry if you think that it's too harsh. I just meant that there's no way using built-in functions, because they will be update every time the sheet is recalculated. You must insert them as static text or static date, which is also explained in the MSDN article I linked. And there will less keystroke (only 2 instead of TODAY()) – phuclv – 2018-09-17T06:59:30.987

1

One way that may work for you is to use a circular reference and enable iterative calculation.

  • In Options select the Formulas tab and tick the Enable iterative calculation option.
  • In cell B1 enter the formula: =IF(A1<>"",IF(B1="",TODAY(),B1),"") (it will return a blank)
  • Format the cell as a date.
  • Add a value to cell A1 - text saying "Date:" would be a good choice.
    The current date should appear in cell B1 and not update.

Downsides

  • Editing the formula will recalculate it to 0 - or 00/01/1900 in date format.
  • Removing the value in cell A1 and adding it back will recalculate the date.
  • Users

Iteration is the repeated recalculation of a worksheet until a specific numeric condition is met. Excel cannot automatically calculate a formula that refers to the cell — either directly or indirectly — that contains the formula. This is called a circular reference. If a formula refers back to one of its own cells, you must determine how many times the formula should recalculate. Circular references can iterate indefinitely. However, you can control the maximum number of iterations and the amount of acceptable change.
Change formula recalculation, iteration, or precision

Darren Bartrup-Cook

Posted 2018-09-17T05:21:01.023

Reputation: 167