+ Reply to Thread
Results 1 to 9 of 9

Treating letters in a string as numbers

  1. #1
    Registered User
    Join Date
    01-25-2017
    Location
    Cedaredge, CO
    MS-Off Ver
    2010
    Posts
    3

    Treating letters in a string as numbers

    Hi all, this seems like it should be a simple thing, but I am stumped. I am entering ISBN numbers from my book collection, and some of them end with a letter (Generally "X"). This is making it near impossible to set to the standard ISBN-13 format (000-0-00000-000-0). For example, what I have is "156504018x". What I need to do to it is format it to look like "000-1-56504-018-X". I set up the format to be 000-0-00000-000-0, and it works great until it gets to the ones that involve the letter. Can someone please help?!?!?!
    Last edited by rogue.phoenix; 01-25-2017 at 07:12 PM.

  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,959

    Re: Treating letters in a string as numbers

    Hi, welcome to the forum

    If you would be willing to remove the x, that could be done (probably) with a helper column?
    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
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: Treating letters in a string as numbers

    try this formula
    =TEXT(LEFT(A1;LEN(A1)-1);"0-000000-00000")&RIGHT(A1)

  4. #4
    Registered User
    Join Date
    01-25-2017
    Location
    Cedaredge, CO
    MS-Off Ver
    2010
    Posts
    3

    Re: Treating letters in a string as numbers

    The problem is that I am transferring the information into a program to search the internet to find the books. The X is unfortunately a necessary evil. You did give me an idea however... Might be able to break the whole ISBN down to the separate specific parts then re-concatenate them... That sure seems like a lot of work for something that seems so simple though...

  5. #5
    Registered User
    Join Date
    01-25-2017
    Location
    Cedaredge, CO
    MS-Off Ver
    2010
    Posts
    3

    Re: Treating letters in a string as numbers

    Quote Originally Posted by Ghozi Alkatiri View Post
    try this formula
    =TEXT(LEFT(A1;LEN(A1)-1);"0-000000-00000")&RIGHT(A1)
    Once I replaced all of the ";" with "," and made a small modification to the format, that worked like a charm! Here's the updated format in case anyone else has a similar problem.

    =TEXT(LEFT(A1,LEN(A1)-1),"000-0-00000-000-")&RIGHT(A1)

  6. #6
    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,959

    Re: Treating letters in a string as numbers

    Well even if you format the contents to look like that, that will not affect the underlying cell contents. Formatting a a cosmetic change so things look how we want them to look.

    A cell could display 000-1-56504-018-X, but the actual cell contents would still just be 000156504018X

  7. #7
    Registered User
    Join Date
    10-12-2013
    Location
    Seattle, USA
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    36

    Re: Treating letters in a string as numbers

    rogue-ph, you could simplify that a bit given that the input is always exactly 13 characters. In that case there's no need to to use the LEN(A1-1) part. So your formula would be =TEXT(LEFT(A1,12),"000-0-00000-000-")&RIGHT(A1)

    FDibbins is right that a number that is formatted for display using Excel's number formats will not work as a search term for your purposes. However, the formula we're discussing produces a text output (not a number formatted for display), so you'll be just fine using it as a search term.

  8. #8
    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: Treating letters in a string as numbers

    Here's a UDF that should work

    Enter =ISBN(A1)

    Please Login or Register  to view this content.
    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.

  9. #9
    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,959

    Re: Treating letters in a string as numbers

    Quote Originally Posted by ianpage View Post
    rogue-ph, you could simplify that a bit given that the input is always exactly 13 characters. In that case there's no need to to use the LEN(A1-1) part. So your formula would be =TEXT(LEFT(A1,12),"000-0-00000-000-")&RIGHT(A1)

    FDibbins is right that a number that is formatted for display using Excel's number formats will not work as a search term for your purposes. However, the formula we're discussing produces a text output (not a number formatted for display), so you'll be just fine using it as a search term.
    Ian, I missed your post after posting mine. yes, your should work for a search, because it is actually changing the cell contents

+ 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. Separating string of letters/numbers in one cell
    By DF001 in forum Excel General
    Replies: 13
    Last Post: 06-26-2015, 09:23 AM
  2. Replies: 13
    Last Post: 07-30-2014, 12:03 PM
  3. Formula to separate numbers from letters in string
    By cmb80 in forum Excel General
    Replies: 3
    Last Post: 07-17-2014, 04:56 AM
  4. How to separate numbers and letters in string
    By rwgrietveld in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2013, 04:28 PM
  5. Treating letters as numbers.
    By mterek in forum Excel General
    Replies: 4
    Last Post: 01-28-2010, 01:14 AM
  6. Dividing a letters and numbers string
    By konkursor in forum Excel General
    Replies: 6
    Last Post: 01-25-2009, 05:38 PM
  7. [SOLVED] Splitting string into letters and numbers
    By Foss in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2005, 07:06 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