+ Reply to Thread
Results 1 to 13 of 13

Converting Text to Numbers when they're also over 15 characters long

  1. #1
    Registered User
    Join Date
    03-27-2017
    Location
    Penticton, BC
    MS-Off Ver
    2016
    Posts
    40

    Lightbulb Converting Text to Numbers when they're also over 15 characters long

    I am having a struggle... I keep circling back.

    I know how to do the data validation to convert text to numbers.
    I know how to get rid of scientific notations.
    I know how to =Trim(A2).

    But when you need to do TWO of the things, it won't give desired results! I need to convert from TEXT AND eliminate the sci notation.

    I'm struggling to convert the long "text" string of numbers into straight numbers without Excel converting all the ending digits to 0's.

    I'm importing card numbers to excel from crystal reports. The numbers range in character lengths of 2 to 18. It imports all of these cards as a text string.

    When I use data validation it scientifically notates all the long number PLUS is also screws with the ending digits - changing them all to 0. I'm going buggy!!

    I've attached a sample. Three tabs, one showing the original master data, second tab shows after validation and third tab shows after fixing sci notation.

    I'm hoping it's something I'm overlooking!!

    Sue
    Attached Files Attached Files

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,742

    Re: Converting Text to Numbers when they're also over 15 characters long

    I am afraid versions older that Excel 2019 will require VBA for that.

    Here is a handy User defined function that I "borrowed" from Rick Rothstein and modified.

    Please Login or Register  to view this content.
    If you are not familiar with how to install this:

    1. Copy code above
    2. Press Alt and F11 on your keyboard to open VB Editor
    3. Click on Insert and select Module
    4. Paste code into Module and close VB Editor.

    Don't forget to save your worbook as Macro-Enabled workbook.
    Dave

  3. #3
    Registered User
    Join Date
    03-27-2017
    Location
    Penticton, BC
    MS-Off Ver
    2016
    Posts
    40

    Re: Converting Text to Numbers when they're also over 15 characters long

    You mean.... I actually found something Excel can't do?

    I might pass out.

    Thanks for the fast response. I was researching the 'mid' function to take out some of the middle numbers, but dismissed. I'm preparing our database for a new software and want to keep things as 'pure' as possible. I have another work around using another column that will clear up 70%. I guess I'm adjusting the other 30% manually!

    Will leave this open for another day incase anyone else has a suggestion! xx

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,742

    Re: Converting Text to Numbers when they're also over 15 characters long

    I'm afraid as you have discovered there is a 15 digit limitation for numbers in Excel. They have to be converted to text after that.... with no numeric value

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,742

    Re: Converting Text to Numbers when they're also over 15 characters long

    If you are able to upload a sample Excel file (confidential info removed or "dummied" up) there might be a work around. But without seeing what you are actually dealing with it is not easy to tell.

    The instructions for file upload are in the gold banner at the top of each page.

  6. #6
    Registered User
    Join Date
    03-27-2017
    Location
    Penticton, BC
    MS-Off Ver
    2016
    Posts
    40

    Re: Converting Text to Numbers when they're also over 15 characters long

    I did attach with my original question. Did I not do it correctly? I can see it and click on it?

    I need to convert to numbers because I have other tables that have columns that I need to add to this spreadsheet (pricing groups). Both tables have the card numbers as a common column, I need to get the Price groups into a table that also contains the Client ID. My purpose for converting is so I can do Vlookups and Matches. I've tried doing it with them both in "text" and it doesn't work. Nothing but NAs.

    S.
    Attached Files Attached Files
    Last edited by BBFDSue; 06-01-2021 at 03:50 PM.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,742

    Re: Converting Text to Numbers when they're also over 15 characters long

    Edit: Our posts crossed in the ether. LOL Let me look at your last post.

    I'm importing card numbers to excel from crystal reports. The numbers range in character lengths of 2 to 18. It imports all of these cards as a text string.
    I am not familiar with crystal reports.

    I was researching the 'mid' function to take out some of the middle numbers, but dismissed. I'm preparing our database for a new software and want to keep things as 'pure' as possible.
    After reviewing your first and 2nd posts it occurs to me I will need a more thorough understanding of what you are starting with. It appears your Master data already has what you want. What am I missing?

  8. #8
    Registered User
    Join Date
    03-27-2017
    Location
    Penticton, BC
    MS-Off Ver
    2016
    Posts
    40

    Re: Converting Text to Numbers when they're also over 15 characters long

    I need these numbers to be Numbers. Not Text. The master data shows the numbers, but it's text - not numbers.

    It won't let me do the Vlookup or match functions with them as they are.

    When I convert them to numbers it works, except for the cards that are beyond 15 characters. (The majority of our cards are only 5 digits). But I have around 1500 cards that are larger than 15 characters. (Thankfully the other 11,500 cards are all 5 digits long).

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,742

    Re: Converting Text to Numbers when they're also over 15 characters long

    It won't let me do the Vlookup or match functions with them as they are.
    It sounds like the lookup issues are what need attention. May we see samples of where lookups are causing problems? There are ways to coerce numbers into text so that they match the text "numbers".

    I have seen these type of problems with Vlookup in the past. They were eventually worked out, but without representative context I would have no idea what to suggest. There's almost always a lot of trial and error involved.
    Last edited by FlameRetired; 06-01-2021 at 04:40 PM.

  10. #10
    Registered User
    Join Date
    03-27-2017
    Location
    Penticton, BC
    MS-Off Ver
    2016
    Posts
    40

    Re: Converting Text to Numbers when they're also over 15 characters long

    Ok. I built a new sample with what I'm looking for in the column headers. I also put in the formulas I'm using. The match one works moderately well. The Vlookup: Not at all.

    Thank you for digging deeper with me!

    Sue
    Attached Files Attached Files

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,742

    Re: Converting Text to Numbers when they're also over 15 characters long

    OK. Thank you for the latest upload. That helps immensely.

    The formula in Worksheet 2 E3 is =VLOOKUP(C3,'Worksheet 1'!A2:C16,3,FALSE)

    First the table_array range isn't correct. Recall that the lookup of the lookup_value is performed on the first column of the table_arrary ie column A of 'Worksheet 1'!A2:C16. The card numbers are in column B. Also the table_array range reference needs to be set absolute. The relative range you have changes as you copy down. Those changes made the col_index_num needs to be changed from 3 to 2.

    When I do all of that to the formula in column E

    =VLOOKUP(C3,'Worksheet 1'!$B$2:$C$16,2,FALSE)

    The formula works where there is matching data.

    I also tried =VLOOKUP(C3,'Worksheet 1'!$B$2:$B$16,1,FALSE) to test for number vs text issues. I found none. Are you sure this is a representative sample?

  12. #12
    Registered User
    Join Date
    03-27-2017
    Location
    Penticton, BC
    MS-Off Ver
    2016
    Posts
    40

    Re: Converting Text to Numbers when they're also over 15 characters long

    Holy crap.

    I can't believe I spent 6 hours down this rabbit hole. Thank you so much for redirecting me to the initial problem and most simplest of solutions!

    I really appreciate it!!

    Thank you!

    Sue

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,742

    Re: Converting Text to Numbers when they're also over 15 characters long

    Sue you are most welcome. Thank you for the feedback, added rep and marking your thread Solved.

    Dave

+ 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. [SOLVED] Remove 7 characters from the middle of a long text string
    By jsohng in forum Excel General
    Replies: 9
    Last Post: 02-13-2017, 01:22 PM
  2. Splitting a long text by words not characters
    By Stwong in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-09-2015, 10:17 PM
  3. [SOLVED] Converting text-number to a long data type.
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-15-2012, 07:37 PM
  4. Adding 0's before a text to make it 6 characters long
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-21-2010, 05:37 AM
  5. Replies: 6
    Last Post: 01-13-2010, 10:26 AM
  6. Replies: 1
    Last Post: 01-04-2006, 06:25 PM
  7. Converting characters to numbers
    By Robbie aka Zoqaeski :p in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-02-2005, 03:06 AM

Tags for this Thread

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