+ Reply to Thread
Results 1 to 5 of 5

Help Formatting Numbers in Formulas

Hybrid View

  1. #1
    Registered User
    Join Date
    06-20-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    30

    Help Formatting Numbers in Formulas

    As below and attached, I have a cell with file names, which I then strip the date & time from using mid-selection, to give ...


    ABC_20230519_230043 20230519 2300



    I would ideally like to format the date and time cells, so date column is yyyyy-mm-dd and the time column is hh:mm.


    Is there any way of doing this directly, without adding more columns of calculations? formatting as time, date or custom isn't working for me.

    Thanks.
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,381

    Re: Help Formatting Numbers in Formulas

    Would you be allowed to use DATE() and TIME() function in conjunction with MID() to extract each date and time element and feed it into a formula so that Excel can convert the string to a proper date/time serial number?

    =DATE(MID(A1,5,4),MID(A1,9,2),MID(A1,11,2)) in B1 for the date portion.
    =TIME(MID(A1,14,2),MID(A1,16,2),0) in C1 for the time portion?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,411

    Re: Help Formatting Numbers in Formulas

    Power Query
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Split Column by Delimiter" = Table.SplitColumn(Source,"Column1",Splitter.SplitTextByDelimiter("_", QuoteStyle.Csv),{"Column1.1", "Column1.2", "Column1.3"}),
        #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"Column1.1"}),
        #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Column1.2", type date}, {"Column1.3", Int64.Type}})
    in
        #"Changed Type"
    Attached Files Attached Files

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,939

    Re: Help Formatting Numbers in Formulas

    Try below formula
    =LEFT(A1,SEARCH("_",A1))&TEXT(SUBSTITUTE(MID(A1,SEARCH("_",A1)+1,256),"_",""),"####\-##\-##\ ##\:##\:##")
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Help Formatting Numbers in Formulas

    Hi.

    Is your forum profile showing the Excel PRODUCT that you need this request to work with?

    The best solutions often rely on knowing WHICH Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date. If you aren't sure, in Excel go to File/Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent Excel PRODUCTS are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the Version number in your profile (e.g. MS365 (PC) Version 2211). The version number is in the About Excel section further down the Account page.

    Cheers,

    Glenn.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

+ 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: 2
    Last Post: 02-14-2019, 01:27 PM
  2. [SOLVED] Formatting numbers and formulas as text doesn't really work
    By chengafni in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-02-2017, 06:33 AM
  3. Formatting and formulas for dates, fills & numbers
    By LG99 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-05-2013, 10:58 PM
  4. [SOLVED] Conditional formatting - formatting the lowest 2 numbers in a list of 12 numbers
    By ktbb0312 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-09-2013, 09:59 AM
  5. Replies: 2
    Last Post: 05-15-2013, 11:08 PM
  6. [SOLVED] Conditional Formatting Formulas for Date, Text and Values/Numbers
    By pblobe in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-09-2013, 12:26 AM
  7. Formatting of numbers affecting formulas
    By JakeMann in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-03-2013, 03:56 AM

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