View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
david mcritchie david mcritchie is offline
external usenet poster
 
Posts: 691
Default Can anyone help me with a Formula

Hi Dick,
Worksheet solution:
C2: =(B2-A2+(A2B2))*24

There are 24 hours is a day. Time is a fraction of a day.
So a datetimestamp takes nor more space than either alone.

The B1B2 is a logical it returns 0 if false and 1 if true.
Add 24 hours if A2B2.

Of course you could the same type of logic in a program
(macro) if your really want to.

You could subtract them as times without multiplying
by 24 and format the result as time [h]:mm:ss
the [h] is more useful for totals and keeps hours
from overflowing into days.

More information on Date and Time at
http://www.mvps.org/dmcritchie/excel/datetime.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Dick Smith" wrote in message ...
Hi.
I'd appreciate it if some kind soul out there can work out a formula for me.
I've spent weeks trying to fathom one out but all I do is end up pulling my
hair out.
Ok I need a formula that will do the following:-

24hr clock times between and column C to calculate total hours

Column A Column B Column C
18.00 20.00 2
05.15 07.30 2.25
21.00 02.00 5
10.30 11.15 0.75
06.00 18.00 12
etc.etc.etc.

I'd appreciate any help that will help me solve the problem

Thanks in anticipation

Dick Smith