Excel 2010 formula help - TODAY() date on cell

Good Morning,

I have a spreadsheet which shows the stock of our toners (sample below):

For column F (Date Deplenished) i have a formula, for when the stock reaches "0" todays date will be inserted. Formula is:

=IF(D6=0,TODAY(), " ")

Open in new window

I added the above formula yesterday so the date originally read "10/14/2015". However upon opening the spreadsheet this morning, I've noticed that the date has changed to todays date of "10/15/2015".

This is not going to work, as the date needs to be set to the date when the stock reached "0" and stay that way until I increase it in the "Current Stock" in column D.

Can someone advise how I can accomplish this?

Kind Regards,
KevinInformation TechnologyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
The only way that you can accomplish this by formula is that you convert that formula to values as today() formula is linked to the system dates as and when the system date will changes the today() formula will give you updated result an answer..

As a alternative you can do a paste special-->values over the cell which will leave the value over the cell rather then the formula..

In additional if you want to do it automatically then you can do with a macro where i can write a  macro for you which does what you are looking for automatically..

KevinInformation TechnologyAuthor Commented:
Thank you for your response Saurabh.

Yes it needs to be done automatically, as I will be locking down several cells and giving the spreadsheet to the office manager to update and having them manually do a special paste each time, is not going to work.

I would appreciate very much if you could write that Macro and let me know how to apply it, I myself am not too familiar with Excel in that aspect.

Kind Regards,
Saurabh Singh TeotiaCommented:
Just use this code..Put this in the sheet module of your workbook of that worksheet where you want to apply this..lets say this is sheet1 when you press alt+f11 for the visual basic editor..then the above code will go to the sheet1 of the workbook and it will automatically put the date in as soon the value is typed zero in the D Column...

Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Me.Range("D:D")) Is Nothing Then Exit Sub

    Dim rng As Range
    Dim cell As Range
    Set rng = Target.Cells

    For Each cell In rng
        If cell.Value = 0 And cell.Value <> "" Then Cells(cell.Row, "f").Value = Format(Now(), "mm/dd/yyyy")
    Next cell

End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KevinInformation TechnologyAuthor Commented:
Thank you Saurabh.

Everything appears to work. However please allow me to wait until tomorrow to ensure the date is OK before accepting your solution.

Kind Regards,
KevinInformation TechnologyAuthor Commented:
Works great. Thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.