+ Reply to Thread
Results 1 to 6 of 6

Can't formar number to time

  1. #1
    Registered User
    Join Date
    10-12-2014
    Location
    USA
    MS-Off Ver
    15
    Posts
    11

    Can't formar number to time

    So there are a bunch of fields with time values in them, showed like: "6:20 PM", "10:00 PM" etc

    \1

    If I average them by a certain field, they get to be displayed as number (serial?).
    I tried "CDate", "TimeSerial", "Format(xx, "h:nn:ss")" - and for all of them I was getting errors (like data mismatch).

    Does anyone know how to convert this to time? I need them to be displayed as "5:30 PM".

    p.s. okay, one of the solutions is to insert: "h:nn AM/PM;@" in the format line. But is there another way?
    Attached Images Attached Images
    Last edited by dramadeur; 11-30-2014 at 08:38 PM.

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Can't formar number to time

    After you use your average formula which will look like this

    =AVERAGE(A1:A3)

    simply right click and format as time then choose HH:mm

    ** OK just realised this was access not Excel - BUT Formating should be the same.
    Last edited by Crooza; 11-30-2014 at 09:18 PM.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Can't formar number to time

    Time is a decimal of 1 (day), so for instance 06:00 AM is actualy just 0.25, 12 noon is .05 and 06:00 PM (18:00) is 0.75. Again, excel formats it to something we see as a time

    It sounds like you just need to format your answers as time?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Can't formar number to time

    With your query open in design view, right click on the field. Click on properties. In the format field, type hh:nn:ss
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    10-12-2014
    Location
    USA
    MS-Off Ver
    15
    Posts
    11

    Re: Can't formar number to time

    Quote Originally Posted by Crooza View Post
    After you use your average formula which will look like this

    =AVERAGE(A1:A3)

    simply right click and format as time then choose HH:mm
    Have you read post scriptum in the original post? I know about field properties. I was looking for another way. Maybe through formulas, for instance serial number 0.75 is equal to 6PM, right? So if a formula multiplies 0.75 by 24, then somehow changes it to 6 and adds "PM" at the end, that'd be it. Adding "AM/PM" shouldn't be hard since you get a number within 1-24 range (e.g. iff X is <12 then AM, else PM).

    Quote Originally Posted by FDibbins View Post
    It sounds like you just need to format your answers as time?
    Yes.


    Quote Originally Posted by alansidman View Post
    With your query open in design view, right click on the field. Click on properties. In the format field, type hh:nn:ss
    See post scriptum in the original post. I had already posted this solution. Give me another.

  6. #6
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Can't formar number to time

    Ok. If I was looking for help I'd probably phrase my responses a little differently. Good luck

    Feel free to use 'thank you' and 'please' too at any time

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 11-26-2014, 10:35 PM
  2. [SOLVED] Converting an elapsed time in decimal number format to an actual time :S
    By Spicey_888 in forum Excel General
    Replies: 3
    Last Post: 07-20-2014, 08:53 PM
  3. Replies: 10
    Last Post: 10-30-2013, 07:29 PM
  4. Replies: 21
    Last Post: 11-30-2012, 07:28 PM
  5. Converting 4 digit number to time unit and extrapolating time to run from there
    By shaunsul in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-31-2011, 08:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1