calendar with multiple drop down in one cell

fonsy

New Member
Joined
Apr 29, 2013
Messages
2
Hi, I'm new here so please be kind...

So, I'm trying to create a calendar where I will have the whole month of lets say "April" and in one cell I need time in and time out separated by a comma, with one hour of lunch, which won't count towards the total of added hours for the day. It is easy to figure lets say 9:00am to 5:00pm = 8 hours, but it should be 7 because of the hour for lunch. I don't need it to say "time in and time out".

Ps* I'm using drop down list for making things easier once is done.

As for now I used this formula to substract the hour:
=MAX(0,MOD(D2-C2,1)-IF(MOD(D2-C2,1)>5/24,"1:0"))

... it worked fine if I have two different cells running the function, but it won't work if the two times are sitting in just one cell. It gives me a decimal value when I need h:m. I tried to fix that by formating the cells to hours, but still wont' work.

I used this code in order to add the two values in one cell:


Dim oldVal As String
Dim newVal As String

If Target.Address(0, 0) <> "C7" Then Exit Sub
On Error GoTo ReEnable
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If oldVal <> "" And newVal <> "" Then
Target.Value = oldVal & ", " & newVal
End If
ReEnable:
Application.EnableEvents = True

End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub

So basically this is what I'm trying to accomplish:
Fonsy 9:00, 5:00 <----- in one cell selected from the drop down menu; total hours = 7 in a different cell.

I'm not an expert on excel, so I've been running into a wall and it kind of hurts..

Thank you for your help
fonsy
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I'm using EXCEL 2010. I forgot to mention that in the previous post.

Thank you again!
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,668
Members
449,463
Latest member
Jojomen56

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