Consulting

Results 1 to 13 of 13

Thread: Solved: Transform general format in time format

  1. #1

    Solved: Transform general format in time format

    Hello,

    Could u help me please on this simple ( I supouse ) question? I have a column with numbers in general format (they indicate the number of seconds of a phone call) and I need to put them in time format (hh:mm:ss). If I do that from he format menu I it apears 00:00:00.

    Thx,
    Nedy

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    So the seconds are in the cell as a whole number?

    Do this:
    • In an unused cell type 86400
    • Copy that cell
    • Select the column / cells your numbers are in
    • From the Menu Bar: Edit | Paste Special | Divide
    • From the Menu Bar: Format | Cells | Custom | h:mm:ss

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    In an adjacent cel add

    =A1/24/60/60

    and format as time

  4. #4
    Thx .. it works in both ways ... A curiosity : why 86400?? ... It is the number of seconds of a day, but how it works? if isn't to hard to explain! ...

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    86400 is 24*60*60 (the same numbers that I used in my formula). This is because Excel stores time as a faraction ofd a day, 24 hours is 1. There are 24 hours in a day, 60 minutes in an hour, and 60 seconds in a minute.

  6. #6
    Hi,

    There seems to be a problem. For every 60 seconds I get some extra seconds. For example for 60 I abtain 0:01:01, for 120 - 0:02:03, 180 - 0:03:04 ...

    Thx,
    Nedy

    Quote Originally Posted by DRJ
    So the seconds are in the cell as a whole number?

    Do this:
    • In an unused cell type 86400
    • Copy that cell
    • Select the column / cells your numbers are in
    • From the Menu Bar: Edit | Paste Special | Divide
    • From the Menu Bar: Format | Cells | Custom | h:mm:ss

  7. #7
    This one it works fine ... no extra seconds :P ..


    Quote Originally Posted by xld
    In an adjacent cel add

    =A1/24/60/60

    and format as time

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    It is probably due to Excel's floating point arithmetic engine. There is always the possibility of some small rounding issue being introduced.

  9. #9
    Hello,

    First of all thx for u're answer. Now can u tell me pls how do I do the oposite?? I meen to transform a time format ( 0:01:30) in general format ("90" - that would meen 90 seconds).

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    =A1*24*60*60

  11. #11
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location
    Quote Originally Posted by nedy_03
    Hello,

    First of all thx for u're answer. Now can u tell me pls how do I do the oposite?? I meen to transform a time format ( 0:01:30) in general format ("90" - that would meen 90 seconds).
    just multiply it to 24*60*60 then change the format to "general"

  12. #12
    Hi there,

    I'm back with a new question .. could u please help me? .. This time i sabout access .. I have a combo box with two options .. If I choose one of it I want some fields to be blocked ... if I choose the otherone the same thing for other fields ..

    Thx,
    Nedy

  13. #13
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Access application? There is a forum for Access who are better at that stuff.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •