+ Reply to Thread
Results 1 to 24 of 24

Trouble extracting and keeping numbers from an alphanumeric string

  1. #1
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Trouble extracting and keeping numbers from an alphanumeric string

    Hello,

    I am trying to pull the numbers out of an alphanumeric string using the below formula, but Office 2007 will throw up a vauge error and highlight the $1 character:

    Please Login or Register  to view this content.
    I'm trying to take column A:

    abc123
    123abc
    ab123c

    and generate column B:

    123
    123
    123

    I'm new ot Excel, so this may very well be somehting simple I have or haven't done correctly.
    Thanks in advance.

  2. #2
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Hi hammer32,

    Did you tried to confirm the formula using Ctrl + Shift + Enter not just Enter..

    Regards,
    Deb

  3. #3
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Deb,

    Yes, thank you. The error I get is:

    "The formula you typed contains an error."

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,721

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Works okay for me. Do you normally use semicolons instead of commas to separate parameters in formulae?

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Pete,

    Today would be my first time using formulas in Excel.

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    =LOOKUP(99^99,--("0"&MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),ROW($1:$10000))))

    Courtesy of:*Ron Coderre
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  7. #7
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Hi Hammer...

    then welcome to the rude world..

    * Copy the above formula..
    * Selcect B1, Press F2, and then paste Formula..
    * Now HOLD Ctrl & Shift, and press ENTER.

    * Now start giving data in A1.. A2.. and drag the formula from B1 to downward by using mouse, on the Right bottom of cell B1..

    Regards,
    Deb

  8. #8
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Trying a smaller subset of the above formula,

    Please Login or Register  to view this content.
    When I hit Ctrl-Shift-Enter Excel highlights the "($1:$9)" and in a dropdown window says "ROW([reference])"

    Sorry, I'm pretty new at this.

  9. #9
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Quote Originally Posted by Debraj Roy View Post
    Hi Hammer...

    then welcome to the rude world..

    * Copy the above formula..
    * Selcect B1, Press F2, and then paste Formula..
    * Now HOLD Ctrl & Shift, and press ENTER.

    * Now start giving data in A1.. A2.. and drag the formula from B1 to downward by using mouse, on the Right bottom of cell B1..

    Regards,
    Deb
    Deb,

    No dice, same error and it highlights the $1 in B1 after holding Ctrl & Shift and pressing Enter.

    Sean

  10. #10
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Quote Originally Posted by oeldere View Post
    =LOOKUP(99^99,--("0"&MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),ROW($1:$10000))))

    Courtesy of:*Ron Coderre
    Ron,

    Thank you, my machine also highlights the $1 in this formula as well. Could there be some setting whereI have to enable Excel to be able to process the $ character?

    Thanks,

    Sean

  11. #11
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    and if you open my file, you get the same faillure (on $1)?

  12. #12
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Quote Originally Posted by oeldere View Post
    and if you open my file, you get the same faillure (on $1)?
    Ron,

    It works just fine on your file... How odd, it must be a settings thing somewhere.

  13. #13
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    @hammer32

    My name is Oeldere

    I borrowed the code from "Ron Coderre"

    And if you try the formula in a new workbook, you get the same faillure?
    Last edited by oeldere; 06-08-2013 at 07:23 AM. Reason: changed english text

  14. #14
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Oeldere,

    So the formula you typed above with the $1 gives the same error all the time, but in the excel workbook you sent the formula:

    Please Login or Register  to view this content.
    which does work in your workbook and new workbooks, but not in the workbook I've been working on with my data. There, it highlights the RC[-1] and doesn't know what to do with it. The R1 expression causes the 'R' row to be highlighted.

  15. #15
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Hi,

    You're not set to R1C1 reference style or something (OptionsFormulas)?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  16. #16
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Quote Originally Posted by XOR LX View Post
    Hi,

    You're not set to R1C1 reference style or something (OptionsFormulas)?

    Regards
    Thank you!

  17. #17
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Quote Originally Posted by XOR LX View Post
    Hi,

    You're not set to R1C1 reference style or something (OptionsFormulas)?

    Regards
    Thank you!

  18. #18
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Since it is working on my an your new workbook, maybe your file is corrupt.

    A suggestion => Is it an option to copy your data to a new workbook and try it in the new workbook.

  19. #19
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Quote Originally Posted by oeldere View Post
    Since it is working on my an your new workbook, maybe your file is corrupt.

    A suggestion => Is it an option to copy your data to a new workbook and try it in the new workbook.
    I will, thank you for bearing with me.

  20. #20
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Thanks for the reply (and thanks for the rep(utationpoints)).

    Glad I could help.

  21. #21
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    No worries, I could have spent days on this problem.

  22. #22
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    So it wasn't the R1C1 referencing that was causing it?

  23. #23
    Registered User
    Join Date
    06-08-2013
    Location
    Kabul
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    It was both the R1C1 and my inability to code.

  24. #24
    Registered User
    Join Date
    05-17-2013
    Location
    Saudi Arabia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Trouble extracting and keeping numbers from an alphanumeric string

    Thanks Xor LX, you pointed in the right direction. I was also suspicious why it is not working for hammer32 and for everyone else working fine. Hammer32 here is what you can try to make things right. Go to Excel options (by clicking the office button on top left corner), then Formulas and there you will find "R1C1 reference style", uncheck if it is checked. Now even if you enter your formula which you provided in the beginning of the thread and then pressing Ctrl + Shift + Enter..... Your formula should work now.
    Hope that will help

+ 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