View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Bridges[_2_] Bob Bridges[_2_] is offline
external usenet poster
 
Posts: 257
Default military time set up

Pattio, don't just say "it didn't work"; think about what they were trying to
accomplish, and figure out what they did wrong. What you want is a normal
fractional display of hours - like "12.75" instead of "12:45" - and then
change the period to a colon, if you really need that. (I never heard of
that, but what the heck.) So start with a date-time stamp and work it across
to your desired value one step at a time.

For instance, the NOW() function generated "2009-05-31 18:10:43" on my PC
just now. That's the value 39964.75744 (39 964 days starting from
1900-01-01), where 0.75744 is the fraction of a day represented by 18:10:43.

Separate the time part of that timestamp by some method, say
MOD(TimeStamp,1). Now you have 0.75744.

Now multiply it by 24. That gives you 18.17859167. ROUND(time,2) is 18.18.

There's more than one way to change that to "18:18". Teethless mama was
trying to turn 18.18 into a string "18.18" and then use SUBSTITUTE to change
the '.' into ':'; he just got the functions in the wrong order. Or you can
take separate the integer and fractional parts, display them each as text and
insert your own colon between. Jacob's method started further back, using
the HOUR and MINUTE functions to pull just those parts of the time and,
again, put the colon between them; that might be the easiest way to do it,
but if he made a minor error you'll have to think about it and correct it.

If you're TRYING to think about it and can't understand what they're driving
at, you'll have to ask questions. Thinking about it part of the fun; don't
deprive yourself of it just because you're in a hurry. After all, if you
don't find it fun, it's hardly fair to ask everyone else to do it all for you.

--- "Pattio" wrote:
Did not work. the formula has an error at "00\