Time in formulae

  • Thread starter Thread starter Bob Hoath
  • Start date Start date
B

Bob Hoath

I have a time value in a cell (A1) formatted hh:mm. Say the value is 20:00.
In cell B1 I am trying to write a formula IF(A1>17:00,A1-17:00,0). This
should give me an answer 3:00 but I get error reports. I have tried
enclosing in brackets but to no avail. Any suggestions please?
 
Try instead in B1: =IF(A1>17/24,A1-17/24,0)
Format B1 as time ("13:30" format)

Excel stores times as a fractional portion of a 24 hour day

So 20:00 is stored as "0.8333" (=20/24)
and 17:00 as "0.70833" (=17/24)

The difference: 0.8333 - 0.7083 = 0.125
which displays as: 3:00 (in time format)

For more info, do check out Chip's:
http://www.cpearson.com/excel/datetime.htm#AddingTimes
 
sorry, wrong value if a1< 17:00, try this instead

=IF(A1>--("17:00"),MOD(A1,--("17:00")),0)
 

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

Back
Top