Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 9, 9:52*am, WLMPilot
wrote: Sorry, forgot you were working with a macro. *I am not sure I am answering your question, but the formula below will convert the to hours vs. hrs:mins worked. I also am currently working with a macro and the following was suggested to me in order to get the time worked converted to hours, instead of hours/minutes. I use a userform to input the time in/out, but I believe *you are pulling in that data from a spreadsheet. ttltime2 = 24 * (CDate(TextBox3.Value) - CDate(TextBox2.Value)) Textbox3 = time clocked out Textbox2 = Time clocked in. DIM ttltime2 As Double Les " wrote: Is there away to go through excel and sum the only the total hours that someone has worked for each day The format that my excel worksheet is: Name1 * 12/15/2007 0:41 | Out * 12/15/2007 0:44 | Out * 12/15/2007 0:44 | IN * 12/15/2007 0:44 | IN * 12/15/2007 16:11 | IN * 12/15/2007 16:18| Out * 12/17/2007 *9:03 | IN * 12/17/2007 *12:27 | OUT * 12/17/2007 *12:51 | IN * 12/17/2007 *17:08| Out Etc for all users the "|" represents the next column In the last column I have calculated all *if the times by using the following formula in a Macro =A4-A3+IF(A3A4,1) But this gives me everything. *Now I need to calculate just the times that the person has worked throughout one day (it does not matter if it is during a weekend; I just need the total hours)- Hide quoted text - - Show quoted text - Thank you for your help. What I decided to to do is create the formula in the Macro. By doing this I do not have to worry about calculating all of the IN times; excel will do this for me through the formula once I find the range Below is my code Dim sFormula1 As String Dim i As String Dim j As String Dim k As String Dim Date1 As Date Dim Date2 As Date Range("C1").Select Date1 = ActiveCell.Offset(0, -2) Do While ActiveCell.Value < "" Date1 = ActiveCell.Offset(0, -2) If ActiveCell.Offset(0, -2) = Date1 Then Do While ActiveCell.Offset(0, -2).Value = Date1 If ActiveCell.Offset(0, -1).Value = "IN" Then i = ActiveCell.Row End If j = i If j < "" Then k = k & "," & "C" & j If k = "," & "C" & j Then k = "C" & j End If End If j = "" i = "" ActiveCell.Offset(1, 0).Select Loop sFormula1 = "=SUM(" & k & ")" ActiveCell.Offset(-1, 1).Value = sFormula1 End If k = "" ActiveCell.Offset(1, 0).Select Loop This is not probably the most perficient way but it seems to work. The reason why I do have all of the time s seperated by IN and OUT is because this report is recorded by our dorr badges ans we enter the building. The excel file is just a data dump into a CSV file If you do know an easier way to code this it would be greatly appreciated Once again I thank you for your help |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 calculate time between 2 date/time columns | Excel Discussion (Misc queries) | |||
Calculate Ending time using Start Time and Elapsed Time | Excel Worksheet Functions | |||
calculate hours using start time & end time, excluding weekends | Excel Programming | |||
IF statement to calculate time usage in specific time bands | Excel Worksheet Functions | |||
how to calculate time start & time finish in quarter hour | Excel Discussion (Misc queries) |