Solved

Make time using event offsets in sql or excel

Posted on 2012-03-16
3
284 Views
Last Modified: 2012-03-16
Shift and events
Above is an image of a table containing events occuing during a shift. I have a start time and an end time for the shift but I am trying to convert the fields "StartOffset" and "StopOffset" into time. I've used some contacts along with the floor function to create time but that off set represented minutes from midnight (0 = 12:00:00 AM). I thought I could maybe use the same approach but instead using the ShiftStartTime as my floored time. Didnt work. Any assistance with this would be much appreciated.
0
Comment
Question by:spaced45
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37731573
If this is one-time then you can follow the following steps.

Enter a value 1440 in any blank cell
Select the cell
Ctrl-c
select the start and stop data (without headers)
paste-special with "Divide" option
OK
Select shift start data (without headers)
Ctrl-c
select the start and stop data (without headers)
paste-special with "Add" option
OK
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 37731600
The same has been programmed in a macro.

Sub timeoffsets()
Dim cel As Range, tgt As Range
Set cel = ActiveSheet.Cells.SpecialCells(xlCellTypeBlanks).Cells(1, 1)
cel.Value = 1440
cel.Copy
Set tgt = ActiveSheet.Range("D2:E" & ActiveSheet.Range("D2").End(xlDown).Row)
tgt.PasteSpecial , operation:=xlPasteSpecialOperationDivide
ActiveSheet.Cells.SpecialCells(xlCellTypeBlanks).Cells(1, 1).Select
cel.ClearContents
tgt.Offset(, -2).Resize(, 1).Copy
tgt.PasteSpecial , operation:=xlPasteSpecialOperationAdd
End Sub

Open in new window

0
 
LVL 1

Author Closing Comment

by:spaced45
ID: 37731836
Worked Great!
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question