Excel Function Help Please

R

Rob

Hello, I am trying to automate the calculation of hours.

For Example:

A B C
9:00 AM 3:00 PM 6 Hours

I am trying to automate the calculation of C.

Any help would be appreciated.

Thanks
Rob
 
F

Felipe

If A and B (cells A1 and B1) are in the same day, just
type =B1-A1 in another cell. That result will have a time
format, if you want a number format, and the cell value to
be in hours, use: =(B1-A1)*24

Regards,
Felipe
 
J

Jane Graves

As long as the times are numerical values and don't span
midnight, the following ought to do it:

=TEXT(B2-A2,"h")&" Hours"

Jane
 
T

theroo

Excel is very smart. If you enter your values as date-time excel automatically handles a cross over midnight. Enter your values this way 11/8/02 23:25. The trick is date SPACE time. You can choose whatever date/time format you want but enter both in the same cell separated by a space. Amazing ain't it. Assume cell A1 is START TIME and B1 is END TIME. In cell C1 just enter formula =(B1-A1). You'll have the correct days, hours, minutes, seconds (depends on how you format the cell). Since Excel has the dates as well as the times even if the times cross over midnight it knows what has happened and does the right thing.. It's built into Excel.
 
T

Tom Ogilvy

Unless this is just an exciting announcement to anyone interested, it would
probably be more useful to the original poster if you answered in the
original thread.

--
Regards,
Tom Ogilvy

theroo said:
Excel is very smart. If you enter your values as date-time excel
automatically handles a cross over midnight. Enter your values this way
11/8/02 23:25. The trick is date SPACE time. You can choose whatever
date/time format you want but enter both in the same cell separated by a
space. Amazing ain't it. Assume cell A1 is START TIME and B1 is END TIME.
In cell C1 just enter formula =(B1-A1). You'll have the correct days,
hours, minutes, seconds (depends on how you format the cell). Since Excel
has the dates as well as the times even if the times cross over midnight it
knows what has happened and does the right thing.. It's built into Excel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top