+ Reply to Thread
Results 1 to 8 of 8

Custom Formatting of nos. separated by hyphen

Hybrid View

  1. #1
    Registered User
    Join Date
    04-06-2012
    Location
    India
    MS-Off Ver
    Pro Plus 2019
    Posts
    86

    Custom Formatting of nos. separated by hyphen

    Hi!

    I wish to join no. content of 2 cells and then separate the result by hyphen.
    The length of characters in the original cells can vary but the custom formatting result should remain the same as below:

    A1: 12345
    B1: 123456
    C1: 12,345-1,23,456 (Expected result)

    No. length of original cells can vary but display format result has to be in following fashion: XX,XX,XX,XXX-XX,XX,XXX (i.e. last three digits after comma and all preceeding digits in groups of two)

    Example:
    1. 123-12,345
    2. 1,234-235
    3. 12,345-1,345
    4. 1,23,456-23,345
    5. 12,34,567-1,23,456
    6. 1,23,45,678-12,345
    7. 12,34,56,789-1,23,456

    Any ideas on a formula or custom formatting to get this result?

    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
    53,048

    Re: Custom Formatting of nos. separated by hyphen

    If you just want to join A1 and B1 with - in between, then would thing work for you?

    =A1&"-"&B1

    edit: oops sorry, didnt read the part about the formatting
    Last edited by FDibbins; 05-27-2013 at 01:16 AM.
    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
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Custom Formatting of nos. separated by hyphen

    Please show it in excel with atleast 5 examples with expected output for better understanding


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Custom Formatting of nos. separated by hyphen

    try
    =CONCATENATE(TEXT(A1,"#,###"),"-",TEXT(B1,"#,###"))
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  5. #5
    Registered User
    Join Date
    04-06-2012
    Location
    India
    MS-Off Ver
    Pro Plus 2019
    Posts
    86

    Re: Custom Formatting of nos. separated by hyphen

    Quote Originally Posted by vlady View Post
    try
    =CONCATENATE(TEXT(A1,"#,###"),"-",TEXT(B1,"#,###"))
    Thanks vlady
    Your solution works as required.

  6. #6
    Registered User
    Join Date
    05-27-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Custom Formatting of nos. separated by hyphen

    Hi there, I am trying to do the oppsite of concatenate; I have the string shown below and need to separate th 4 digit number onloy in the next column. Is there a function for that ?

    T-2331[b]-NELINDA-T.10

  7. #7
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Custom Formatting of nos. separated by hyphen

    Welcome to the forum Renzo, may I suggest that you create a new thread regarding your problem.

    When you click on sub forum eg. "Excel Formulas & Functions" you'll notice the "Post New Thread" button.


    Thanks.

    Regards,
    Vlaidmir

  8. #8
    Registered User
    Join Date
    05-27-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Custom Formatting of nos. separated by hyphen

    Thanks Vlady, I just did.

    Cheers !

+ 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