View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Parse a Cell value using another listing showing criteria

On Mon, 28 Sep 2009 07:13:02 -0700, rosefest
wrote:

Thank you. Not sure how the Macro works, but it did split up most of the
part numbers in my sheet. The places it did not work were where the part
number was different than the samples I provided. But they are in the
minority.
Thanks again.


Glad to help.

The macro uses the following "rule" to parse the string:

"^([A-Z])(\w\d*)(\D+)(\d\D*)(\d*)"

^ Start at beginning of line

Group 1
[A-Z] A single capital letter

Group 2
\w\d* A single letter or digit followed by zero or more digits

Group 3
\D+ One or more non-digits

Group 4
\d\D* A single digit followed by zero or more non-digits

Group 5
\d* Zero or more digits

This "rule" seemed to match all of your supplied examples. I glad to see it
worked on the majority. If there is only a small minority, it may not be worth
it to tweak it further. (And, of course, I don't know if it is possible). But
if you want to provide some examples, I could take a look later this week.
--ron