+ Reply to Thread
Results 1 to 4 of 4

Merging Numbers with custom format - how to keep format

  1. #1
    Registered User
    Join Date
    03-28-2008
    Posts
    94

    Angry Merging Numbers with custom format - how to keep format

    I have three digit numbers in columns A,B and C. They are custom formatted so that if there is not a third digit it adds a "0" to the front.

    Example: 25 would be 025.

    I used the equation: =A2&"-"&B2&"-"&C2 to combine them into one cell separated by dashes.

    The problem that I am having is that the 0's are being dropped. How do I keep the first 0's?

    A B C D What I need
    025 054 065 25-54-65 025-054-065
    068 002 095 68-2-95 068-002-095
    001 085 004 1-85-4 001-085-004

    I am trying to merge this number into a report and trying to use custom formatting does not translate.

    Thank you,
    Last edited by oddcarout; 08-15-2012 at 07:54 PM.

  2. #2
    Forum Contributor CheshireCat's Avatar
    Join Date
    10-11-2011
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    258

    Re: Merging Numbers with custom format - how to keep format

    Try this:

    Please Login or Register  to view this content.
    Docendo discimus.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Merging Numbers with custom format - how to keep format

    Hi,

    Formatting, whether custom or standard does not change the underlying value, only what the value looks like.

    You need to work with the actual values. i.e.

    =REPT("0",3-LEN(A1))&A1&"-"&REPT("0",3-LEN(B1))&B1&"-"&REPT("0",3-LEN(C1))&C1
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    03-28-2008
    Posts
    94

    Re: Merging Numbers with custom format - how to keep format

    Quote Originally Posted by CheshireCat View Post
    Try this:

    Please Login or Register  to view this content.
    This worked.

    Thank you,

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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