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
 

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,458
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,747
Messages
5,597,905
Members
414,189
Latest member
Duque_

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