Solved

Make time using event offsets in sql or excel

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now