+ Reply to Thread
Results 1 to 16 of 16

How to add auto hyphenations to the numbers added in cell

  1. #1
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chandigarh
    MS-Off Ver
    Excel 2010
    Posts
    122

    Post How to add auto hyphenations to the numbers added in cell

    Hello Friends,
    Warm Greeting !!

    I wanted to ask all the experts could it be possible to add auto hyphenations to the numbers added in cell for example if in A1 we write two numbers like 9735331786, 9735732438. Could it be possible that numbers automatically gets hyphens in A1 in the set of three, like 973-533-1786, 973-573-2438.

    Please provide me non VBA or Macros solution.

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: How to add auto hyphenations to the numbers added in cell

    Use "000\-000\-0000" as custom number formatting (Ctrl+1 > Custom)

    or alternatively, if you want the output in another cell (and as a text string), you can use the formula,

    =TEXT(A1,"000\-000\-0000")


    Cheers,
    berlan

  3. #3
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chandigarh
    MS-Off Ver
    Excel 2010
    Posts
    122

    Re: How to add auto hyphenations to the numbers added in cell

    Hello berlan,
    Thanks for your assistance and timely response, you idea worked but I need to make bit alteration in the formula but when I enter two numbers in the cell formula stops working.
    You gave me formula of "000\-000\-0000" but when ever I add any number in the cell the result appears "000\-000\-0000"
    I removed inverted comas i.e ("") and added the following in customized box ie 000\-000\-0000 & result appeared was exactly what I needed but it stops working if in same cell I add two set of numbers like stated in my question i.e 9735331786, 9735732438.

    How can I achieve the result of 973-533-1786, 973-573-2438 in same cell.

    Please find the excel sheet on which I tried this formatting.

    Quote Originally Posted by berlan View Post
    Use "000\-000\-0000" as custom number formatting (Ctrl+1 > Custom)

    or alternatively, if you want the output in another cell (and as a text string), you can use the formula,

    =TEXT(A1,"000\-000\-0000")


    Cheers,
    berlan
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    04-15-2015
    Location
    beirut
    MS-Off Ver
    2010
    Posts
    107

    Re: How to add auto hyphenations to the numbers added in cell

    you can use this formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chandigarh
    MS-Off Ver
    Excel 2010
    Posts
    122

    Re: How to add auto hyphenations to the numbers added in cell

    Thanks Salim,
    But My purpose is not to create any new column or row for the result, If my formula is in A2 than I want it to be usable as well so that I can add information in that for example changing the formatting or adding some formula in data validation so that formula should go in background and result is achieved in same cell.

    Regards,

  6. #6
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: How to add auto hyphenations to the numbers added in cell

    Hi,

    it's correct to use 000\-000\-0000 without any inverted commas (apologies for the confusion), but note that it can only be applied to numbers, or rather cells recognized as numbers.

    Cell A5 in your sample file is recognized as a string which is why this cannot be applied. How is your data looking otherwise, how many sets of numbers do you have in your cells?

    You could use a formula to first separate the different numbers (e.g. given comma as a separator) and then apply this on each set of numbers, but it would involve a longer and more complicated formula. Another way would be to use VBA.

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: How to add auto hyphenations to the numbers added in cell

    I'm not sure that this can be achieved with formatting. As soon as you try to combine the two numbers into a single cell, the cell contents become a text string which is not effected by number formatting. You are welcome to review the different number format codes https://support.office.com/en-us/art...2-09fab54be7f4 but I do not think there is anything in there to describe a formatting option to break up text into pieces with a character between them.

    If I understand what you are wanting, I think you are going to need to do something with a CONCATENATE() and TEXT() formula like Salim ali was suggesting. Maybe something like =CONCATENATE(TEXT(9735331786,"000-000-0000"),", ",TEXT(9735732438,"000-000-0000")).
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  8. #8
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chandigarh
    MS-Off Ver
    Excel 2010
    Posts
    122

    Re: How to add auto hyphenations to the numbers added in cell

    Thanks for your quick reply Berlan and MrShorty,
    My file is actually consisted of candidates whose database I am creating in excel it contains name ; email and phone numbers, some times when candidate gives their incomplete number we are not able to figure out if its not hyphenated and we have to type so fast that we don't have enough time to use hyphen after every three set, in one single cell we sometimes add one number and sometimes two numbers, I want that either during my typing hyphen should be added so that I can recognize the incomplete of additional digits in number. I could have designed my own VBA code but in our office systems macros and VBA settings are disabled so I want to discover some way out to overcome such a issue.

    Quote Originally Posted by berlan View Post
    Hi,

    it's correct to use 000\-000\-0000 without any inverted commas (apologies for the confusion), but note that it can only be applied to numbers, or rather cells recognized as numbers.

    Cell A5 in your sample file is recognized as a string which is why this cannot be applied. How is your data looking otherwise, how many sets of numbers do you have in your cells?

    You could use a formula to first separate the different numbers (e.g. given comma as a separator) and then apply this on each set of numbers, but it would involve a longer and more complicated formula. Another way would be to use VBA.

  9. #9
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: How to add auto hyphenations to the numbers added in cell

    With this in mind, why are you trying to avoid the use of a helper column/row? It seems to me that the easiest solution to this kind of problem is to have one or more cells designated as "data entry" cells where you can enter the phone number(s). Then have a formula in an adjacent cell that will take the data entered and process it according to your needs. It is difficult to visualize what that formula will be without knowing exactly what your data entry will look like or what variations you need to be able to account for. Once one understands what the data will look like, what it should look like, and the different variations that need to be looked for, then he/she should be able to put together a function or a series of functions that can manipulate the entered text string accordingly.

  10. #10
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chandigarh
    MS-Off Ver
    Excel 2010
    Posts
    122

    Re: How to add auto hyphenations to the numbers added in cell

    My file has around 12 different column and by shrinking them I have made them to remain on screen without making me to scroll left and right
    I am adding amount also for these candidates in which I get various other figures as per the plans, I cant afford more columns because I same formula will be applicable on many other column like SSN and zipcodes if for every column I will start making another formula column than I will be soon increasing 12 column to extra 6 column as well.
    Quote Originally Posted by MrShorty View Post
    With this in mind, why are you trying to avoid the use of a helper column/row? It seems to me that the easiest solution to this kind of problem is to have one or more cells designated as "data entry" cells where you can enter the phone number(s). Then have a formula in an adjacent cell that will take the data entered and process it according to your needs. It is difficult to visualize what that formula will be without knowing exactly what your data entry will look like or what variations you need to be able to account for. Once one understands what the data will look like, what it should look like, and the different variations that need to be looked for, then he/she should be able to put together a function or a series of functions that can manipulate the entered text string accordingly.

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: How to add auto hyphenations to the numbers added in cell

    I don't have any solutions, but to make sure everything is clear, you need a solution that:

    1) Does not use VBA -- worksheet formulas only.
    2) Does not add columns, so the data must be entered and processed in the same cell.
    3) A formatting option does seem to be the only possibility, but, as noted above, formatting is very limited for text string entries.

    If I am understanding the thread, these are the main requirements. Normally, I would say that 1) and 2) are pretty close to mutually exclusive requirements, since number formatting seems to be out of the question. I don't know that exactly what you want will be possible. I think you will either need to relax the requirement against VBA, so that a macro can be written that will process the data as it is entered or after it is entered. Or you will need to use additional columns to process the data as it is entered.

    Have I got the essential requirements correct?

  12. #12
    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,938

    Re: How to add auto hyphenations to the numbers added in cell

    I want it to be usable as well so that I can add information in that for example changing the formatting or adding some formula in data validation so that formula should go in background and result is achieved in same cell.
    Just to be clear - a cell can contain either data (text/numbers) OR a formula, it cannot contain both. It sounds to me that you want some magical formula to be working in thE cell while you enter data (text or numbers) into it.

    If that is what you want, then pretty much, your opnly options are to enter the hyphens as you type, or to use VBA. ANY formatting you do, like has been suggested (berlan - Use "000\-000\-0000" as custom number formatting (Ctrl+1 > Custom)
    will not actually change the contents of the cell, ONLY it's apperance.

    The cell will still contain 123456789, even if the custom formatting makes it show 123-456-789

    Also, almost any other formatting you apply (apart from colors/fonts) will replace that custom formatting
    Last edited by FDibbins; 10-12-2015 at 09:35 PM.
    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

  13. #13
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: How to add auto hyphenations to the numbers added in cell

    I see you don't want a new column you need formatting...
    Maybe what you want instead is just conditional formatting that highlights the errors - make the cell red or something.

    isn't making it hyphenated less effective than highlighting the error in red?

    another option might be to have a second sheet which fixes the result with the formula and you enter on the front sheet (no loss in screen real estate - just the entry and result sheets are different).
    Last edited by scottiex; 10-12-2015 at 09:19 PM.

  14. #14
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: How to add auto hyphenations to the numbers added in cell

    Quote Originally Posted by warriorpoet7176 View Post
    My file has around 12 different column and by shrinking them I have made them to remain on screen without making me to scroll left and right
    And I assume hiding the extra helper columns is not an option?
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: How to add auto hyphenations to the numbers added in cell

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  16. #16
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to add auto hyphenations to the numbers added in cell

    If you cannot use VBA or macros (XLM) or helper columns, you can't do what you want.
    Remember what the dormouse said
    Feed your head

+ 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. Auto-Fill Or Auto-Copy A Newly-Added Row To A Different Row (Same Sheet)
    By miemhaiii in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-01-2014, 06:27 PM
  2. auto populate a formula in a cell as new rows of data are added
    By CharterJP in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-30-2012, 06:43 PM
  3. Auto add date when data added/modified/deleted in cell.
    By serahkins in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2012, 08:11 AM
  4. Replies: 3
    Last Post: 07-11-2011, 09:52 AM
  5. Auto Fill Cell Value added by "Copy N Paste"
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2009, 05:58 PM
  6. Auto Fill Cell w/Username & Date if Value added
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2009, 10:27 AM
  7. Replies: 6
    Last Post: 10-09-2005, 12:05 AM

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