Insert static time stamps into two different cells based on the variable of another cell

Banyatec

New Member
Joined
Oct 27, 2017
Messages
1
Hello,

I would like Excel to insert a time in and a time out into the time in and out columns. When someone arrives we change the 0 to a 1 next to their name and then enter in the time manually to the time in column. When they leave we change 1 back to a 0 and then enter in the time manually to a different column. So we have 3 key columns. the first filled with 0's or 1's, and two others containing time in and time out. We sort the spread sheet very often using the 1's and 0's column to distinguish who is present and who is not. What is the formula that tells excel to time stamp a cell when the 0 is changed to a 1 and then time stamp a different cell when the 1 is changed back to a 0. We sort very often throughout the day and need the time to be static not dynamic after each sort.

Thanks.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
something along the lines of

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Value = 1 Then
Target.Offset(0, 1) = Time
End If
If Target.Column = 1 And Target.Value = 0 Then
Target.Offset(0, 2) = Time
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,110
Messages
6,128,894
Members
449,477
Latest member
panjongshing

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