Posts by bezet

    Re: VBA to Extract text with certain pattern from a string within a single cell

    Quote from bryce;789740

    here you go. I changed the pattern a little. Instead of looking for 4 numbers and 1 character at the end of the part number I simply look for 5 numbers or letters. There is also no need to remove the item No. xxx or the numerical listing in front of the part number. This returns only the part number

    Dude. This is impressive!The amount of code is way less than I have in mind when I plan to do it before. Thanks!

    Re: VBA to Extract text with certain pattern from a string within a single cell

    Quote from bryce;789634

    see if this works. FYI your sample includes strings that are not consistent with the pattern you say should exist.

    Hi Bryce,

    Thanks for the feedback.

    You are right on the pattern, they are not consistent as per my explanation. My intention was to get a solution for ###-TT-###-####T then try my hand in changing it to fit the rest of the pattern.

    I will give the code a try and let you know how it goes with the real samples.

    I think my explanation was a bit vague, the entire text actually contained in a single cell which mean we need to manipulate the data on string level (e.g The entire quoted text is in cell A1) , one of the reason why I was stuck since I'm not familiar with string manipulation.. Your example consider each line is kept in an individual cell. Should looks like this, as shown in the photo below. (I tried attaching file but seem I have issue with the forum attachment system)

    [Blocked Image:]

    Dear All, I have a string contained in a single cell as below.

    I need a way to extract the text 50-PG-103-6101X, 100-D-105-6101X, 150-BD-101-6101X, 150-PG-127-6101X and 80-PG-142-61430 into another cell. Preferably in this format.


    I tried searching all over the net, but none of the solution can do it ( or maybe I'm using the wrong search term). Hope you guys can point me at the right direction.