Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

excel, office, formula, calulate

Posted on 2013-02-06
3
Medium Priority
?
325 Views
Last Modified: 2013-02-08
I have an Excel Document that has the following columns:
 A11 = Date In  (Date Format)      
 B11 = Time In      (Time Format)
 C11 = Date Out       (Date Format)
 D11 = Time Out (Time Format)

We need to calculate the amount of hours and minutes between the two date and time period.
How can this be done?

Screenshot of the spreadsheet setup attached.
0
Comment
Question by:bax2000
3 Comments
 
LVL 26

Assisted Solution

by:redmondb
redmondb earned 500 total points
ID: 38859027
Hi, bax2000.

The formula is...
=A13+A14-A11-A12
..and you need to format the cell as follows...
[h]:mm
...(the square brackets tell Excel to display Hour values greater than 24.)

Regards,
Brian.
0
 
LVL 49

Accepted Solution

by:
PortletPaul earned 500 total points
ID: 38859028
this will work; but it has no exception handling

=(C11-A11)+(D11-B11)

e.g.
date in      time in      date out     time out   hours
1/02/2013      9:16      1/02/2013      17:23      8:07

Open in new window

if you think that isn't sufficient try:
=DATE(YEAR(A11),MONTH(A11),DAY(C11))-DATE(YEAR(C11),MONTH(C11),DAY(C11))+(TIME(HOUR(D11),MINUTE(D11),SECOND(D11))-TIME(HOUR(B11),MINUTE(B11),SECOND(B11)))

Open in new window


If the number of days isn't multiplied by 24, but (for example) a "day" is 8 hours, then:


=((C11-A11)*8)+(D11-B11)

or the more comprehensive alternative:

=(DATE(YEAR(A11),MONTH(A11),DAY(C11))-DATE(YEAR(C11),MONTH(C11),DAY(C11))*8)+(TIME(HOUR(D11),MINUTE(D11),SECOND(D11))-TIME(HOUR(B11),MINUTE(B11),SECOND(B11)))

Open in new window

and the "8" (hours per day) could be a cell reference of course.

if there are any standard deductions (e.g. for lunch) then that could be added into the formula also.
0
 

Author Closing Comment

by:bax2000
ID: 38859154
All Working as needed.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

877 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