+ Reply to Thread
Results 1 to 5 of 5

multiple record to single with frequent change in string at forward slash

  1. #1
    Registered User
    Join Date
    06-17-2012
    Location
    UNITED STATES
    MS-Off Ver
    Excel 2010
    Posts
    29

    Lightbulb multiple record to single with frequent change in string at forward slash

    hi all,

    I want to count the below records to two single records (based on cts and ibm). Each string should repeated only once

    finance/economy/boy/cts=12

    finance/economy/girl/cts=3

    finance/economy/boy/cts=6

    education/economy/boy/cts=2

    commerce/non-economy/girl/cts=3

    finance/economy/boy/cts=6

    finance/economy/girl/ibm=2

    finance/economy/boy/ibm=4

    Output should be like this "education/finance/commerce/economy/non-economy/boy/girl cts=32"

    "finance/economy/boy/girl/ibm=6"

    Please note that data string are frequently changed at respective to the left and right of forward slash and record are in dynamic range.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: multiple record to single with frequent change in string at forward slash

    I can't see an easy way to get the string ordered the way you demonstrate, but this will put each code into the string one time and collect the totals at the end.

    Assuming the data is in column A, run this:

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 06-26-2012 at 02:33 AM. Reason: errors corrected, in red.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-17-2012
    Location
    UNITED STATES
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: multiple record to single with frequent change in string at forward slash

    Thanks JBeaucaire for spending your valuable time in checking this query.
    Its working fine. When I used the same in another sheet (another requirement) by changing cts and ibm to CTs and SRs,
    I am getting run time error. Could you please check the data in attached sheet.

    Is it possible that I want only two records (based on CTs and SRs) only in same column(A:A) replacing the records which are used
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: multiple record to single with frequent change in string at forward slash

    I've edited the code above to highlight the parts of the code you would need to adapt. Give that a try.

    Your new data has the word "cases" at the end of every string, the macro wasn't designed for uncontrolled variations to be thrown in on every version. Do a search/replace on that data to remove the " Cases" before running the macro.
    Last edited by JBeaucaire; 06-24-2012 at 05:36 AM.

  5. #5
    Registered User
    Join Date
    06-17-2012
    Location
    UNITED STATES
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: multiple record to single with frequent change in string at forward slash

    Thanks a lot for checking the error.

+ 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