adding/subtracting time

G

griffee

I have a worksheet with times formatted as [$-409]h:mm AM/PM;@. I
don't understand the format and would like to be able to subtract times
to get total hours.

i.e. start time = 2:00 PM and end time= 10:00 PM Hours=8
start time = 10:00 PM and end time= 2:00 AM Hours=4


Since I don't understand the current time format (or why they didn't
just use an existing MS format), I don't know how to get my calculation
to work.

TIA
 
B

Bob Phillips

It shouldn't make any difference, it is still just a time value underneath,
so just add them

=A1+B1

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
K

kat

That works great when the time is within the same day, but when it
starts at 10:00PM and ends at 2:00AM I can't calculate the hours.

Currently I just threw out their format and used your solution with the
if function: =IF(b1>a1,"24:00"-(a1-b1),b1-a1) Maybe I overdid it??
but it seems to work fine.

Just curious if anyone has ever come across the weird format I
described in the first post. I thought maybe it was some MVP
supersolution
 
R

Roger Govier

Hi Kat

With start in A1 and End in B1
=MOD(B1,A1,1)
will deal with either scenario
 
B

Bob Phillips

I think Roger means

=MOD(B1-A1,1)

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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