?
Solved

Make time using event offsets in sql or excel

Posted on 2012-03-16
3
Medium Priority
?
286 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 2000 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
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 longer labels with horizontal bar charts instead of the vertical column chart.

762 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