#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 46
Default total hours

Good day,
I would like to get help on the following.
A B C D
19:00 16:00 21jul 21jul
19:00 08:00 21jul 22jul

If it occurs that the date on C and D are the same and the time on B are
earlier than time on A it should be 0.
If time on date on C and D are the same an time on B are later than time on
A it should give the difference.
My main concern are if the date on D are later than C to get the difference
between B and A as it should be 13hours.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default total hours

Try this.

I'm assuming that the date in D will never be less than the date in C.

=IF(AND(C1=D1,B1<A1),0,((B1+D1)-(A1+C1))+(B1+D1<A1+C1)*(D1-C1))

Format as [h]:mm

--
Biff
Microsoft Excel MVP


"ekkeindoha" wrote in message
...
Good day,
I would like to get help on the following.
A B C D
19:00 16:00 21jul 21jul
19:00 08:00 21jul 22jul

If it occurs that the date on C and D are the same and the time on B are
earlier than time on A it should be 0.
If time on date on C and D are the same an time on B are later than time
on
A it should give the difference.
My main concern are if the date on D are later than C to get the
difference
between B and A as it should be 13hours.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default total hours

Isn't it as simple as =MAX(0,(B1+D1)-(A1+C1)) ?
Of course (for my formula and for Biff's) C and D will need to be dates, not
text.
--
David Biddulph

"T. Valko" wrote in message
...
Try this.

I'm assuming that the date in D will never be less than the date in C.

=IF(AND(C1=D1,B1<A1),0,((B1+D1)-(A1+C1))+(B1+D1<A1+C1)*(D1-C1))

Format as [h]:mm

--
Biff
Microsoft Excel MVP


"ekkeindoha" wrote in message
...
Good day,
I would like to get help on the following.
A B C D
19:00 16:00 21jul 21jul
19:00 08:00 21jul 22jul

If it occurs that the date on C and D are the same and the time on B are
earlier than time on A it should be 0.
If time on date on C and D are the same an time on B are later than time
on
A it should give the difference.
My main concern are if the date on D are later than C to get the
difference
between B and A as it should be 13hours.





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default total hours

Isn't it as simple as =MAX(0,(B1+D1)-(A1+C1)) ?

I don't know. If the time span is = 24hrs the above formula fails.


--
Biff
Microsoft Excel MVP


"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Isn't it as simple as =MAX(0,(B1+D1)-(A1+C1)) ?
Of course (for my formula and for Biff's) C and D will need to be dates,
not text.
--
David Biddulph

"T. Valko" wrote in message
...
Try this.

I'm assuming that the date in D will never be less than the date in C.

=IF(AND(C1=D1,B1<A1),0,((B1+D1)-(A1+C1))+(B1+D1<A1+C1)*(D1-C1))

Format as [h]:mm

--
Biff
Microsoft Excel MVP


"ekkeindoha" wrote in message
...
Good day,
I would like to get help on the following.
A B C D
19:00 16:00 21jul 21jul
19:00 08:00 21jul 22jul

If it occurs that the date on C and D are the same and the time on B are
earlier than time on A it should be 0.
If time on date on C and D are the same an time on B are later than
time on
A it should give the difference.
My main concern are if the date on D are later than C to get the
difference
between B and A as it should be 13hours.







  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default total hours

Ooops! Disregard.

It does work. I let Excel "help" and choose the format *it* wanted to use,
h:mm instead of [h]:mm.

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
Isn't it as simple as =MAX(0,(B1+D1)-(A1+C1)) ?


I don't know. If the time span is = 24hrs the above formula fails.


--
Biff
Microsoft Excel MVP


"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Isn't it as simple as =MAX(0,(B1+D1)-(A1+C1)) ?
Of course (for my formula and for Biff's) C and D will need to be dates,
not text.
--
David Biddulph

"T. Valko" wrote in message
...
Try this.

I'm assuming that the date in D will never be less than the date in C.

=IF(AND(C1=D1,B1<A1),0,((B1+D1)-(A1+C1))+(B1+D1<A1+C1)*(D1-C1))

Format as [h]:mm

--
Biff
Microsoft Excel MVP


"ekkeindoha" wrote in message
...
Good day,
I would like to get help on the following.
A B C D
19:00 16:00 21jul 21jul
19:00 08:00 21jul 22jul

If it occurs that the date on C and D are the same and the time on B
are
earlier than time on A it should be 0.
If time on date on C and D are the same an time on B are later than
time on
A it should give the difference.
My main concern are if the date on D are later than C to get the
difference
between B and A as it should be 13hours.









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
total hours vs total worked hours tryingtolearn Excel Discussion (Misc queries) 1 November 19th 06 10:24 PM
How to seperate OT and Reg. Hours from total hours cmc1111 Excel Worksheet Functions 6 August 23rd 06 05:18 PM
Adding minutes showing total in hours/minutes, i.e., 60 mins + 60 mins + 15 mins to total of 2 hours 15 mins? StargateFan Excel Discussion (Misc queries) 8 January 7th 06 07:35 PM
scheduled hours total Jeff Desruisseaux Excel Discussion (Misc queries) 1 July 1st 05 11:38 AM
Total hours with NETWORKDAYS Spencer Hutton Excel Worksheet Functions 2 February 16th 05 04:36 PM


All times are GMT +1. The time now is 08:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"