ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   subtract hours, not time of day (https://www.excelbanter.com/excel-programming/349133-subtract-hours-not-time-day.html)

Steve@Blackhawk

subtract hours, not time of day
 
I would like to subtract hours, not time of day and have it end up in h:mm
format. currently I am subtracting a cell with hours in h:mm format from a
cell in number (0 decimal places) format with the following formula:

=((HOUR(E18)*60)+MINUTE(E18)-($I$8*60))/60

As an example the cell E18 is 30 and cell I8 is 6:45 and my answer is
-23.75. Can I get this cell to format to -23:45 ? I am calculating Comp time
on a timesheet, so the number can be positive or negative.

Thanks,
Steve

Bob Phillips[_6_]

subtract hours, not time of day
 
=IF(E18I8,"-","")&TEXT(ABS(I8-E18/24),"[h]:mm")

--

HTH

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


"Steve@Blackhawk" wrote in
message ...
I would like to subtract hours, not time of day and have it end up in h:mm
format. currently I am subtracting a cell with hours in h:mm format from a
cell in number (0 decimal places) format with the following formula:

=((HOUR(E18)*60)+MINUTE(E18)-($I$8*60))/60

As an example the cell E18 is 30 and cell I8 is 6:45 and my answer is
-23.75. Can I get this cell to format to -23:45 ? I am calculating Comp

time
on a timesheet, so the number can be positive or negative.

Thanks,
Steve





All times are GMT +1. The time now is 01:52 AM.

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