Using an If statement with the TODAY function

MR VEB

New Member
Joined
Aug 16, 2017
Messages
1
Hello all,
I hope you can help me. I have a spread sheet set up and I record when documents are returned to me. When I put the word "returned" in a cell , I'd like the date the document was received to be posted into the adjacent cell on the spread sheet.

Thanks

MR VEB
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
put into the adjacent cell: =today()
copy that cell
and on the same cell --> paste special as value
 
Upvote 0
a coded solution

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 And Target.Value = "Returned" Then
Target.Offset(0, 1) = Date
End If
End Sub
 
Upvote 0
This requires VBA to do it automatically.

Something like this should work.
Right click on the tab of your sheet and select view code
Past the code below into the VBA editor.
The file will need to be saved as .xlsm as .xlsx does not allow macros
You will need to change the ranges to match your data.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("C:C")) Is Nothing And LCase(Target) = "return" Then
    myrow = Target.Row
    Range("D" & myrow) = Date
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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