ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   adding/subtracting time (https://www.excelbanter.com/excel-worksheet-functions/64330-adding-subtracting-time.html)

[email protected]

adding/subtracting time
 
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


Bob Phillips

adding/subtracting time
 
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)


wrote in message
oups.com...
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




kat

adding/subtracting time
 
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(b1a1,"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


Roger Govier

adding/subtracting time
 
Hi Kat

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

--
Regards

Roger Govier


"kat" wrote in message
oups.com...
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(b1a1,"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




Bob Phillips

adding/subtracting time
 
I think Roger means

=MOD(B1-A1,1)

--

HTH

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


"Roger Govier" wrote in message
...
Hi Kat

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

--
Regards

Roger Govier


"kat" wrote in message
oups.com...
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(b1a1,"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






Roger Govier

adding/subtracting time
 
Indeed I did.
Thanks for catching the typo, Bob

--
Regards

Roger Govier


"Bob Phillips" wrote in message
...
I think Roger means

=MOD(B1-A1,1)

--

HTH

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


"Roger Govier" wrote in message
...
Hi Kat

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

--
Regards

Roger Govier


"kat" wrote in message
oups.com...
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(b1a1,"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









All times are GMT +1. The time now is 05:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com