Finding all four digit numbers in a string

  • Hi all. I was hoping the collective brain power in here is better than mine right now.


    I have a column of strings. In each string there will be anywhere from one to three four-digit numbers separated by something, but it is not always the same thing. The numbers are also not in the same place.
    For example:


    A1: blah blah 1234 blah 5678
    A2: blah 9876
    A3: blah blah blah..1234 blah
    A4: blah, 4554 9977


    Does anyone have any suggestions on how to pull out the four digit numbers? VBA is preferable.


    Cheers

  • Re: Finding all four digit numbers in a string


  • Re: Finding all four digit numbers in a string


    Simply awesome. Works like a charm. Thanks, Jindon.


    Regular expressions is not something I've had a chance to learn yet and to be honest, they intimidate me (though I'm sure I'm overreacting).

  • Re: Finding all four digit numbers in a string


    Here's another way that puts the results into a blank column:



    HTH


    Robert

  • Re: Finding all four digit numbers in a string



    You are awesome, jindon you are fantastic dear, it workded fine for 4-digit numeric values. You made my day.
    Now can you please help me by making two smiliar VBA codes one for 4 digit Alpha value and second for four digit Alpha+Numeric mix value. Thanks in advance.

  • Welcome to the Forum


    Please start your own post. Posting in another member's Thread is known as hijacking and is not allowed here. By all means add a link to a Thread that may be related to your question.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!