Using IF Then statement to insert timestamp date

geechung7089

New Member
Joined
Jul 1, 2017
Messages
7
Hi Excel Forum,

I created a drop down menu in one cell with two choices using data validation. One is "In Progress" and "Completed". What I am trying to do is that with a IF THEN statement, if with the drop-down menu "Completed" is selected then in the neighboring cell it will timestamp with today's date that is static which will not change when you open the spreadsheet. Could you please explain what IF THEN statement that can do this?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
have a read here , explains time stamps
and

Instead of NOW() for the time , you can use TODAY() for the date

Then in the IF
use
IF ( cell with dropdown = "completed", IF( cell next to dropdown ="", today(), cell next to dropdown ),"")
by default iterations in formula computation is turned off. , you need to turn on
 
Upvote 0
Hi Etaf,

I tried entering the formula as you stated but I am still getting an error message. Could you use the cells C5 and D5 in your illustration?
I also turned on iteration and set it to 1.

Thanks
 
Upvote 0
=IF(C5="completed",IF(D5="",TODAY(),D5),"")


Book1
ABCDE
3
4
5completed8/1/20
6
7
8IF ( cell with dropdown = "completed", IF( cell next to dropdown ="", today(), cell next to dropdown ),"")
9
Sheet1
Cell Formulas
RangeFormula
D5D5=IF(C5="completed",IF(D5="",TODAY(),D5),"")
 
Upvote 0
Hi Etaf,

The formula works, however, after I save and exit from the file and go back to it later, I have to recheck the enable iterative calculation check box every time, I open the spreadsheet. How can I make sure that everytime I open the spreadsheet, this function is enabled?

Thanks
 
Upvote 0
Would you consider using vba to do the date stamp using Worksheet_Change event code like this? To implement ..
1. Right click the sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test.
4. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm).

This particular code monitors column C for "Completed" or not & puts the date in column D but could be set to any range or single cell if required.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim changed As Range, cell As Range
  
  Set changed = Intersect(Target, Columns("C"))
  If Not changed Is Nothing Then
    Application.EnableEvents = False
    For Each cell In changed
      If LCase(cell.Value) = "completed" Then
        cell.Offset(, 1).Value = Date
      Else
        cell.Offset(, 1).ClearContents
      End If
    Next cell
    Application.EnableEvents = True
  End If
End Sub
 
Upvote 0
I have to recheck the enable iterative calculation check box every time, I open the spreadsheet.
My old version 2013 on windows and the current version i use 365 on OSX MacBook - the iterations setting stay set for the workbook on both. Not sure why its changing on your system
What version of excel do you have running on what software , Windows 10 ?????
Not sure what the fix would be , except to use Peter_SSs suggestion VBA , BUT the iterations should stay set.
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,639
Members
449,093
Latest member
Ahmad123098

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top