1

I am trying to extract a sub-string from a string. The strings are currently in an excel column, row by row and are like this:

ABC 54 SOMETHING 11165 POP 1234567890 SOMETHING ABC/W 05/1234500022385 SomethingW1234500006840Abc05 d 13/1/15 What I want is to extract any 5 or 13-digit number from each row string.

I have come up with this algorithm for the job:

1) Enter line 2) Scan string 3) If numeric/integer found, check length from start to end of numeric string 4) If length = 5 or if length = 13, output only numeric string to next column 5) Enter new line... 6) Continue 1 - 5 Till the data set is exhausted

Is there a function in excel that can do this?

P.S: I am open to learn any language/tool that can get the job done.

1 Answers1

0

It might be easier than you are making it. If I were you, I'd update that question to give unambiguous pairs of inputs and desired outputs. And I would take a good hard look at the accepted answer to this possibly similar question as it looks like it could be useful. Undoubtedly, someone will come up with a more beautiful regex for you, but here is an idea that might work..

Community
  • 1
  • 1
unigeek
  • 2,656
  • 27
  • 27