+ Reply to Thread
Results 1 to 10 of 10

How to create a formula/format for a long number to include a period and not round

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    Bloomington, Indiana
    MS-Off Ver
    Excel 2013
    Posts
    6

    How to create a formula/format for a long number to include a period and not round

    We have a large spreadsheet of that includes lists of numbers 18 digits in length, that are sent to us from an outside source. They begin with an apostrophe. When I try to create a custom number format, then remove the apostrophe, the number automatically adds a zero at the end and won't keep the number. Example: 530040297030000006 should look like 53-00-40-297-029.000-006. I added this custom format: ##-##-##-###-###\.###-### but it removes the 6 from the end of number and replaces it with a zero. I don't know if it's rounding, and how to stop that. I'm pretty new at this, and can't figure out what I need to do to keep that from happening. Any help would be much appreciated. Thanks.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: How to create a formula/format for a long number to include a period and not round

    Excel has a limit of 15-digit precision for numbers - anything larger than that has to be treaded as a text value if you want to preserve all the digits, and of course a custom format is no use for text. The apostrophe forces those digits to be treated as text. If you want to transform that string of digits to have hyphens between some of the digits, then you will need a formula in an adjacent column, along the lines of:

    =LEFT(A1,2) &"-"& MID(A1,3,2) &"-"& MID(A1,5,2) &"-"& MID(A1,7,3) &"-"& MID(A1,10,3) &"."& MID(A1,13,3) &"-"& RIGHT(A1,3)

    You can copy this down and use copy | paste special | values to convert the formulae to values, and then you can copy/paste over the original values if you need to and then delete the helper column.

    Hope this helps.

    Pete

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to create a formula/format for a long number to include a period and not round

    maybe
    =TEXT(LEFT(A1,12),"00-00-00-000-000\.")&TEXT(RIGHT(A1,6),"000-000")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    12-13-2013
    Location
    Bloomington, Indiana
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: How to create a formula/format for a long number to include a period and not round

    Oh wow, this is almost working. The 1st formula from Pete gives the result of: '5-30-04-029-703.100-006
    and the second one: '53004029703000-006. Am I doing something wrong?

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: How to create a formula/format for a long number to include a period and not round

    Ah, I think the cell must be formatted as Text, so the leading apostrophe is taken as being part of the value. Try this amendment to my formula:

    =MID(A1,2,2) &"-"& MID(A1,4,2) &"-"& MID(A1,6,2) &"-"& MID(A1,8,3) &"-"& MID(A1,11,3) &"."& MID(A1,14,3) &"-"& RIGHT(A1,3)

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    12-13-2013
    Location
    Bloomington, Indiana
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: How to create a formula/format for a long number to include a period and not round

    That absolutely worked! Thank you so much. Our assessor's department is going to be thrilled with this formula since they have huge amounts of data in this spreadsheet that needs converted. I would have never been able to figure this out. A million thanks!
    Rita

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to create a formula/format for a long number to include a period and not round

    =TEXT(MID(A1,2,12),"00-00-00-000-000\.")&TEXT(RIGHT(A1,6),"000-000") instead then

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: How to create a formula/format for a long number to include a period and not round

    You're welcome, Rita - glad to be able to help.

    If that takes care of your original question, please select Thread Tools from the menu above your first post and mark this thread as SOLVED.

    Also, since you are relatively new to the forum, I would like to inform you that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

  9. #9
    Registered User
    Join Date
    12-13-2013
    Location
    Bloomington, Indiana
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: How to create a formula/format for a long number to include a period and not round

    Done. Thank you for the guidance. I just joined this forum today.

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: How to create a formula/format for a long number to include a period and not round

    Well, thanks for that, and come back anytime you have a problem with Excel - there will always be someone here to help.

    Have a good weekend.

    Pete

+ 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. Number Format from Round Function within Concatenate
    By zeze in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-23-2020, 03:41 AM
  2. [SOLVED] Round Number Down by Decimal Places Using Format
    By jaclrsen in forum Excel General
    Replies: 8
    Last Post: 10-19-2012, 06:02 AM
  3. Replies: 7
    Last Post: 02-03-2011, 01:12 PM
  4. [SOLVED] Can I format a cell to round a number by 50 basis points (0.5)?
    By daveb in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-18-2005, 09:05 PM
  5. Modifying VLOOKUP formula to include ROUND
    By th1chsn in forum Excel General
    Replies: 1
    Last Post: 02-17-2005, 01:34 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