Solved

Make time using event offsets in sql or excel

Posted on 2012-03-16
3
283 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

730 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