Calculating time

Recoil

New Member
Joined
Aug 30, 2011
Messages
1
Hello,

I was wondering if anyone of you could help me out. In Access I have the following data:


-- removed inline image ---

Date Event StartTm EndTM Difference
2011-08-15 Event3 1:17:00 PM 1:19:00 PM 0:00:00
2011-08-15 Event4 1:19:00 PM 1:42:00 PM 0:00:00
2011-08-15 Event5 1:42:00 PM 1:45:00 PM 0:15:00
2011-08-15 Event6 2:00:00 PM 2:30:00 PM 0:45:00
2011-08-15 Event7 3:15:00 PM 3:25:00 PM 0:00:00
2011-08-15 Event8 3:25:00 PM 3:26:00 PM 0:00:00
2011-08-15 Event9 3:26:00 PM 4:20:00 PM


If would like to do this within a query if possible.

Sorry for the formatting...

Thanks
Recoil
<table style="width: 51px; height: 43px;" border="0" cellpadding="0" cellspacing="0"><tbody><tr style="height:15.0pt" height="20"><td class="xl81">
</td><td class="xl79" style="border-top:none;width:65pt" width="86">
</td><td class="xl79" style="border-top:none;border-left:none;width:80pt" width="107">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl81">
</td><td class="xl79" style="border-top:none;width:65pt" width="86">
</td><td class="xl79" style="border-top:none;border-left:none;width:80pt" width="107">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl81">
</td><td class="xl79" style="border-top:none;width:65pt" width="86">
</td><td class="xl79" style="border-top:none;border-left:none;width:80pt" width="107">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl81">
</td><td class="xl79" style="border-top:none;width:65pt" width="86">
</td><td class="xl79" style="border-top:none;border-left:none;width:80pt" width="107">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl81">
</td><td class="xl79" style="border-top:none;width:65pt" width="86">
</td><td class="xl79" style="border-top:none;border-left:none;width:80pt" width="107">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl81">
</td><td class="xl79" style="border-top:none;width:65pt" width="86">
</td><td class="xl79" style="border-top:none;border-left:none;width:80pt" width="107">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl81">
</td><td class="xl79" style="border-top:none;width:65pt" width="86">
</td><td class="xl79" style="border-top:none;border-left:none;width:80pt" width="107">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl81">
</td><td class="xl79" style="border-top:none;width:65pt" width="86">
</td><td class="xl79" style="border-top:none;border-left:none;width:80pt" width="107">
</td></tr></tbody></table>
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Got it now

Code:
SELECT Sheet1.ID, Sheet1.Date1, Sheet1.Event, Sheet1.StartTM, Sheet1.EndTm, DLookUp("[StartTM]","Sheet1","[ID]=" & [ID]+1) AS NextStartTM, DateDiff("n",[EndTM],[NextStartTm]) AS [Difference in Minutes]
FROM Sheet1;
BTW: The term Date is a reserved word and should not be used in Access

To make this work you need an Id for each record.

Alan
 
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,733
Members
449,465
Latest member
TAKLAM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top