+ Reply to Thread
Results 1 to 12 of 12

Regex: Matching pattern to split a cell data

  1. #1
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Regex: Matching pattern to split a cell data

    Hi all,

    Basically I want to split data into each cell just the number without alphabet and special character.

    The data I want to split is:
    a=1,995.000 b=2,001.000 c=1,994.000 d=1,996.000 e=1,281

    Currently I have a set of code. New to regex, I need some help with the pattern.

    The code work well with the above data. But cant split if the data doesn't have "," or ".".
    ie, e=999. Search and trying a lot, I guess if the .pattern can be fixed then the code is complete.

    The code is as below:


    Please Login or Register  to view this content.
    By Ab33

    Please put the data in column K.

    If you want to see attachment, it below.


    http://www.mrexcel.com/forum/excel-q...ml#post3922941
    Attached Files Attached Files
    Last edited by DavidRoger; 08-30-2014 at 08:27 AM. Reason: Review questions

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Regex: Matching pattern to split a cell data

    Hi DavidRoger,
    try this
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Regex: Matching pattern to split a cell data

    Quote Originally Posted by nilem View Post
    Hi DavidRoger,
    try this
    Please Login or Register  to view this content.
    debug at
    Please Login or Register  to view this content.

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Regex: Matching pattern to split a cell data

    maybe something like this
    Please Login or Register  to view this content.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Regex: Matching pattern to split a cell data

    Hi, DavidRoger,

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    http://www.mrexcel.com/forum/excel-q...plit-data.html

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Regex: Matching pattern to split a cell data

    Quote Originally Posted by nilem View Post
    maybe something like this
    Please Login or Register  to view this content.
    It work for "e=281 f=999"
    but not for "bf2,001.000"
    The standard is ok. e=1,281

    I have attached the file above. Do you mind trying them?
    Last edited by DavidRoger; 08-30-2014 at 08:38 AM.

  7. #7
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Regex: Matching pattern to split a cell data

    Quote Originally Posted by HaHoBe View Post
    Hi, DavidRoger,

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    http://www.mrexcel.com/forum/excel-q...plit-data.html

    Ciao,
    Holger
    Thank you.

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Regex: Matching pattern to split a cell data

    try this
    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Regex: Matching pattern to split a cell data

    David,
    It is not good idea to put your data in column K. You are assuming that match columns will not go beyond column K. Ideally, you should put your data in column A and leave any columns from B blanks, so the code match does not have to overwrite your data. I have moved the data to column M, but if there are more matches, the code will overwrite the data in column M.
    Attached Files Attached Files
    Last edited by AB33; 08-30-2014 at 12:01 PM.

  10. #10
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Regex: Matching pattern to split a cell data

    Hi nilem and AB33,

    Let me study it first. Get back to you tomorrow.

  11. #11
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Regex: Matching pattern to split a cell data

    Hi AB33 and nilem,

    Thank you both. I have fun learning. Wish you both good days.

    Please check the attachment if you are free.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Regex: Matching pattern to split a cell data

    I notice another problem when apply some of the data.
    Some of the data are in this state, 0=1,995.000 b=2,001.000 c=1,994.000 0=1,996.000 e=1,281.
    "0=" is zero equal. As a result, it cant split probably.

  13. #13
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Regex: Matching pattern to split a cell data

    Does this code do what you want...
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Regex - establishing a pattern
    By twckfa16 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-30-2014, 11:06 AM
  2. [SOLVED] RegEx pattern to extract multiplelines title in TXT file
    By p24leclerc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2014, 08:39 PM
  3. [SOLVED] RegEX VBA Split Method
    By goss in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-02-2013, 05:03 PM
  4. Pattern Matching within a dynamic data set
    By sawb23 in forum Excel General
    Replies: 0
    Last Post: 02-03-2013, 04:40 AM
  5. Need a new regex .pattern for comparison code
    By Swiss Cheese in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-06-2012, 09:16 PM

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