Stop automatically refreshing date if a specific word is in another cell

Fire Marshal

New Member
Joined
Aug 1, 2023
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
Good evening. I have a cell (E7) automatically updating with today's date (=TODAY() ). I want to stop or lock E7 from continuing to update if D7 has the word "Approved" in it. Any help would be greatly appreciated. Thanks

Screenshot 2023-08-01 194300.jpg
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
What date should if be a "Case" is approved? We need to pull the date from somewhere

Column will contain either Today's date or some other date. The column will probably have a formula like:

=IF(D7="Approved",?,TODAY()) ... the "?" here is what date should be used if the Case is approved. If you add a column labeled "DATE APPROVED" then the "STATUS DATE" column could be either the approved date or blank. So the formula for E7, for example would be

Either
=IF(D7="Approved",H7,TODAY()) - the date from the new column
or
=IF(D7="Approved","",TODAY()) - blank

Also, please note that the DAYS column appears to be calculated from the STATUS DATE - DATE REVIEWED
so you will need either a date in the STATUS DATE column (i.e. it cannot be blank) or the formula in the DAYS column will have to change.

Therefore, I think the easiest solution for you is add a APPROVED DATE column to your sheet and
Change the formula in Column E7:En =IF(D7="Approved",H7,TODAY()) - if H7 is the new column for the APPROVED DATE
 
Upvote 0
It requires VBA code, in worksheet_Change events.
Below code is placed in worksheet module (not general module), trigger change made in range D7 to last cell in D.
Initial formula in D is =TODAY(), if D change to "approve", E will be fixed to that date.

Right click on tab's name, View Code, then paste the code into
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lr&, cell As Range
lr = Cells(Rows.Count, "D").End(xlUp).Row
If Intersect(Target, Range("D7:D" & lr)) Is Nothing Then Exit Sub
For Each cell In Target
    With cell.Offset(0, 1)
        Select Case cell.Value Like "Approve*"
            Case True
                .Value = .Value
            Case Else
                .Formula = "=today()"
        End Select
    End With
Next
End Sub

Capture.JPG
 
Upvote 1
Solution
It requires VBA code, in worksheet_Change events.
Below code is placed in worksheet module (not general module), trigger change made in range D7 to last cell in D.
Initial formula in D is =TODAY(), if D change to "approve", E will be fixed to that date.

Right click on tab's name, View Code, then paste the code into
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lr&, cell As Range
lr = Cells(Rows.Count, "D").End(xlUp).Row
If Intersect(Target, Range("D7:D" & lr)) Is Nothing Then Exit Sub
For Each cell In Target
    With cell.Offset(0, 1)
        Select Case cell.Value Like "Approve*"
            Case True
                .Value = .Value
            Case Else
                .Formula = "=today()"
        End Select
    End With
Next
End Sub

View attachment 96413
Note: They have 12 worksheets (1 for each month) - if VBA code is used it would have to be applied to each sheet. If the Change event route is the one they like. You code should be in a separate module and the Change event on each applicable tab should call your Sub. Or apply your code at the workbook level.
 
Upvote 0
What date should if be a "Case" is approved? We need to pull the date from somewhere

Column will contain either Today's date or some other date. The column will probably have a formula like:

=IF(D7="Approved",?,TODAY()) ... the "?" here is what date should be used if the Case is approved. If you add a column labeled "DATE APPROVED" then the "STATUS DATE" column could be either the approved date or blank. So the formula for E7, for example would be

Either
=IF(D7="Approved",H7,TODAY()) - the date from the new column
or
=IF(D7="Approved","",TODAY()) - blank

Also, please note that the DAYS column appears to be calculated from the STATUS DATE - DATE REVIEWED
so you will need either a date in the STATUS DATE column (i.e. it cannot be blank) or the formula in the DAYS column will have to change.

Therefore, I think the easiest solution for you is add a APPROVED DATE column to your sheet and
Change the formula in Column E7:En =IF(D7="Approved",H7,TODAY()) - if H7 is the new column for the APPROVED DATE
There are four selections in the Status column, "Submitted," "Approved," "Waiting for correction," and "On Hold." When the status is changed in column D, it needs to add the date the status changed and not update again unless the status changes.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

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