+ Reply to Thread
Results 1 to 2 of 2

How to split string and copy

  1. #1
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    How to split string and copy

    Hi,
    Here is what I am trying to do: I am trying to copy a part of a string and copy it into another columns (Package Size and Package Quantity) but there are 3 scenarios in this problem:
    1) NEUPOGEN 480M CG/1.6 VL 10X1.6 ML
    2) LOVENOX 40 MG PFS 10
    3) COMBIVENT 200 ACT INH 14.7 GM
    So let me explain here what I want to do here:
    Scenario 1) whenever we have ‘X’, everything to the right of ‘X’ is Package Size and everything to the left of ‘X’ is Quantity
    Scenario 2) Whenever the last words in a string are just ‘Numbers’ then that number should be the ‘Package Quantity’ and the ‘Package Size’ is ALWAYS ‘1’
    Scenario 3) Whenever we have numbers at the end followed by letters like GM or ML at last, then this number should be Package Size and the Package Quantity is ALWAYS 1.

    So this is what the example above should look like:
    Package Size Package Quantity
    Scenario 1) 1.6 10
    Scenario 2) 1 10
    Scenario 3) 14.7 1

    The code below works but would like to make some changes to reflect the example above and the solution could be in any format as long as it works I am fine with it. Pls. see attached sample file. Thanks for your help.

    HTML Code: 
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to split string and copy

    I confess I'm no expert of RegExp but the below is based on your narrative - the tests don't seem that convoluted that RegExp is an absolute necessity - however - for you to decide of course.

    Please Login or Register  to view this content.
    Called as before - eg: =PARSERTEST(B2,1) for Size - 2 for Qty.

    Note: I'm not sure I followed all of your expected results but I suspect these nuances may be explained in your RegExp - I confess I've not looked in detail (based above on narrative).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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