+ Reply to Thread
Results 1 to 4 of 4

Macro Help: Finding Letter/Number Combos

  1. #1
    Registered User
    Join Date
    06-01-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Macro Help: Finding Letter/Number Combos

    I have a set of data in column A as shown below:
    3051CD2A02A1AH2B9E5L4
    3051CD2A02A1AH2B9E5L4CN
    3051CG4A02A1AH2B9E5
    3051CG4A02A1AH2B9E5CN
    3051CD3A03A1AH3B3M5E5T1
    3051CD3A03A1AH3B3M5E5T1CN
    3144PD1A1E1B4M5CN
    3144PD1A1E1B4M5
    3051CG5A02A1AH2E5M5CN
    3051CG5A02A1AH2E5M5
    3051CG5A02A1AH2E5M5CNQ4
    3051CG5A02A1AH2E5M5Q4CN


    Each pair listed above with a space in between is the same item, but they are showing up as different items in excel because of the order of the letters and numbers or because they are missing something.

    Is their a way to make a formula that looks in each of the cells with the items and removes the "CN" from the item if there is a "CN" located anywhere in the item. Then it would check to see if items have the same letters and numbers, no matter what order they are in. Then it would add a "CN" to the combinations of letters and numbers that are the same and paste that result in column B.

    So the last pair would go from
    3051CG5A02A1AH2E5M5CNQ4>3051CG5A02A1AH2E5M5Q4>3051CG5A02A1AH2E5M5Q4CN

    I do not even know where to start with this problem because they combinations of letters and numbers are many different lengths. Any help would be much appreciated.

    Thanks,
    J

  2. #2
    Forum Contributor
    Join Date
    01-20-2012
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Macro Help: Finding Letter/Number Combos

    If you put this in column B, does it do what you expect?

    =IF(COUNTIF(A:A; "*" & A1 & "*") > 1; A1 & "CN"; A1)

  3. #3
    Registered User
    Join Date
    06-01-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro Help: Finding Letter/Number Combos

    This is what I got for output in column B:

    3051CD2A02A1AH2B9E5L4CN
    3051CD2A02A1AH2B9E5L4CN
    3051CG4A02A1AH2B9E5CN
    3051CG4A02A1AH2B9E5CN
    3051CD3A03A1AH3B3M5E5T1CN
    3051CD3A03A1AH3B3M5E5T1CN
    3144PD1A1E1B4M5CN
    3144PD1A1E1B4M5CN
    3051CG5A02A1AH2E5M5CNCN
    3051CG5A02A1AH2E5M5CN
    3051CG5A02A1AH2E5M5CNQ4
    3051CG5A02A1AH2E5M5Q4CN


    It added an extra CN onto the first item I bolded, and then on the last pair, I wanted 3051CG5A02A1AH2E5M5CNQ4 to output as 3051CG5A02A1AH2E5M5Q4CN

  4. #4
    Forum Contributor
    Join Date
    01-20-2012
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Macro Help: Finding Letter/Number Combos

    Written it in a macro.
    Does this work better?

    Finding Letter and Number Combos.xlsm

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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