Time calculation help please

Jay2000

New Member
Joined
Dec 5, 2005
Messages
6
I am trying to compute a formula which will allow me to figure out the hours worked for a person. It worked very well until I ran into third shift people who would work beyond 12:00am.

I then found the following formula:

=TEXT(IF(B1<A1,1-A1+B1,B1-A1),"hh:mm")

However this returns the time they worked and not a number.

For example:

Time In 5:30 PM
Time Out 2:00 AM
Total Time worked 8:30 is what is returned
What I want is 8.5

Unfortunately, I think I am making this harder than it is and I am drawing a blank.

Thank you

Jay
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,459
Jay2000 said:
I am trying to compute a formula which will allow me to figure out the hours worked for a person. It worked very well until I ran into third shift people who would work beyond 12:00am.

I then found the following formula:

=TEXT(IF(B1<A1,1-A1+B1,B1-A1),"hh:mm")

However this returns the time they worked and not a number.

For example:

Time In 5:30 PM
Time Out 2:00 AM
Total Time worked 8:30 is what is returned
What I want is 8.5

Unfortunately, I think I am making this harder than it is and I am drawing a blank.

Thank you

Jay

Why are you returning text, by using the TEXT function? Multiply by 24 to return a decimal number.
 

Jay2000

New Member
Joined
Dec 5, 2005
Messages
6
Hmm...

For some reason my formula did not post.

Hopefully it will post this time:

=TEXT(IF(B1<A1,1-A1+B1,B1-A1),"hh:mm")
 

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828
Just multiply your function by 24 and format your cell as General or Number.
 

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828
Re: Hmm...

Jay2000 said:
For some reason my formula did not post.

Hopefully it will post this time:

=TEXT(IF(B1<A1,1-A1+B1,B1-A1),"hh:mm")

Code:
=TEXT(IF(B1<A1,1-A1+B1,B1-A1)

Is that your formula?

Use the Code button before and after the code you want to enter.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,851
Messages
5,833,974
Members
430,249
Latest member
Muka

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
Top