+ Reply to Thread
Results 1 to 10 of 10

formatting x-xxxx as x-xxxx.00

  1. #1
    Registered User
    Join Date
    06-17-2015
    Location
    marin, ca
    MS-Off Ver
    2011
    Posts
    4

    formatting x-xxxx as x-xxxx.00

    hi everyone:

    i have a column of numbers that is a mix of x-xxxx numbers and x-xxxx.00 numbers.

    I am hoping to change them all into x-xxxx.00

    so basically, i want to add a decimal place and two zeros after every number that doesn't have one. I know how to use the format cells, and after playing around with it, it doesn't seem to work with numbers that have a dash.

    that is, 45678 will format as 45678.00 but 4-5678 won't format as 4-5678.00

    anyone know why this is or how I can format? I tried formatting special as xxxxx thinking I could then turn it into xxxxx.00 and then to x-xxxx.00 but it won't turn them from x-xxxx to xxxxx. tried all of this in a brand new workbook. same problems. just seems like the dash throws everything off.

    thoughts? thanks!

  2. #2
    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: formatting x-xxxx as x-xxxx.00

    Hi, welcome to the forum

    it doesn't seem to work with numbers that have a dash.
    thats because they are not numbers, they are text. I dont think you can use formatting like that, on text
    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

  3. #3
    Registered User
    Join Date
    06-17-2015
    Location
    marin, ca
    MS-Off Ver
    2011
    Posts
    4

    Re: formatting x-xxxx as x-xxxx.00

    hm. is there any way to un-format them as text? how can I get them back to numbers?

    thanks!

  4. #4
    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: formatting x-xxxx as x-xxxx.00

    You cannot change the contents of a cell with formatting. 1 way around this would be to use a helper column to remove the - You then either just use that helper column, or copy/paste values over the original date

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: formatting x-xxxx as x-xxxx.00

    if you are not averse to using a helper column (which you could copy >> paste special >> values over your original) you could use something like this... =IF(LEN(A1)<7,A1&".00",IF(LEN(A1)<9,A1&"0",A1)) assuming your values are in column A.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  6. #6
    Registered User
    Join Date
    06-17-2015
    Location
    marin, ca
    MS-Off Ver
    2011
    Posts
    4

    Re: formatting x-xxxx as x-xxxx.00

    ok i will try those. thanks!

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: formatting x-xxxx as x-xxxx.00

    If the contents of column A are text numbers with the dashes some with .00 at the end and some without, this will convert all of them to have .00 at the end.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    RESULT
    A
    B
    2
    12-1234 12-1234.00
    3
    234-4567.00 234-4567.00
    4
    41-1234 41-1234.00
    5
    65.4321 65.4321.00


    With right alignment:
    A
    B
    2
    12-1234
    12-1234.00
    3
    234-4567.00
    234-4567.00
    4
    41-1234
    41-1234.00
    5
    65.4321
    65.4321.00
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: formatting x-xxxx as x-xxxx.00

    A short one

    =SUBSTITUTE(A1,"-","-")&".00"

    Row\Col
    A
    B
    1
    4-5678 4-5678.00
    2
    45678 45678.00
    3
    4-1268 4-1268.00
    4
    3-6578 3-6578.00
    5
    43245 43245.00
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: formatting x-xxxx as x-xxxx.00

    @AlKey

    Your formula handles all the entries that don't already end in .00 but adds .00 to those entries that already end in .00 giving x-xx.00.00

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: formatting x-xxxx as x-xxxx.00

    I guess I didn't read it carefully

    Here is another one.

    =SUBSTITUTE(SUBSTITUTE(A1,"-","-"),".00","")&".00"

    Row\Col
    A
    B
    1
    4-5678 4-5678.00
    2
    45678 45678.00
    3
    4-1268 4-1268.00
    4
    3-6578 3-6578.00
    5
    43245 43245.00
    6
    x-xxxx.00 x-xxxx.00

+ 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: 9
    Last Post: 11-05-2013, 11:06 PM
  2. String manipulation xxx/xxxx/xxxx//
    By mikedu in forum Excel General
    Replies: 3
    Last Post: 04-13-2011, 04:33 PM
  3. Replies: 3
    Last Post: 08-06-2009, 03:02 PM
  4. adding a ' ie 'xxxx instead of xxxx
    By cclambie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-06-2005, 12:25 AM
  5. [SOLVED] change dots to dashes in an account format (xx.xxxx.xxxx) to xx-xx
    By Michael in forum Excel General
    Replies: 1
    Last Post: 07-01-2005, 06:05 PM

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