how do i add hours on a timesheet?

J

JR21

In one cell I have 8:00-5:00 how do I get the cell under it to add these
hours for me so I don't have to manually put in 9 hours?
 
A

Ashish Mathur

Hi,

Try this. The assumption herein is that if the ending time is less than the
beginning time, then the days are apart by a day

=IF(1*MID(B5,SEARCH("-",B5)+1,4)<1*LEFT(B5,SEARCH("-",B5)-1),1*MID(B5,SEARCH("-",B5)+1,4)+TIME(12,0,0)-1*LEFT(B5,SEARCH("-",B5)-1),1*MID(B5,SEARCH("-",B5)+1,4)-1*LEFT(B5,SEARCH("-",B5)-1))*24

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com
 
T

T. Valko

It would be much easier if you used separate cells for the start and end
time *and* you either use a 24 hr format or include the AM/PM with a 12 hr
format.

A1 = 8:00 AM (or 8:00 in 24 hr format)
B1 = 5:00 PM (or 17:00 in 24 hr format)

For a result in time format:

=MOD(B1-A1,1)

Format as h:mm

For a result in decimal format:

=MOD(B1-A1,1)*24

Format as General or Number
 

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