+ Reply to Thread
Results 1 to 10 of 10

Creating Unique codes from two columns

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    Creating Unique codes from two columns

    Hi all,
    Every day I get a long list of data in two colums. Such as follows:
    C1 C2
    q 1
    w 2
    e 4
    r 4
    t 6
    w 4
    For every combination of a value in C1 and C2, there is a unique code which includes text and numbers. EG. 67XY.
    I need to create a macro which creates from the two colums C1 and C2, Column C3 with all the unique codes.
    Can anyone aid me in this?
    Last edited by JBeaucaire; 07-10-2013 at 10:14 AM. Reason: Corrected the title, as per Forum Rules. Please take a moment to read the forum rules, link is in the menu bar above.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Help required Marcro If A and B then C

    Do you have a list of these unique codes?
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    07-10-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Help required Marcro If A and B then C

    Yes, its a long list in excel, which I cant post here due to privacy rights. sorry.
    The list shows me for example:
    q 1 001XY
    q 2 002XY
    w 1 11ZZ
    w 2 TJF

    The list does not show consistancy, as I show above. The unique codes differ in length, and signs.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Creating Unique codes from two columns

    I would look into a simple lookup table.

    Take your unique codes and place them in a table with the q1 in the same column and the 001XY next to it.

    Now in C1 >> =LOOKUP(A1&B1,G1:H4)

  5. #5
    Registered User
    Join Date
    07-10-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Creating Unique codes from two columns

    I hadn't thought of that, but that works perfect thanks!

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Creating Unique codes from two columns

    Glad to hear you have a working solution now and thanks for the feedback.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  7. #7
    Registered User
    Join Date
    07-10-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Creating Unique codes from two columns

    In addition to my last question, maybe you can help with the next step aswell. The lookup function works good, when using an additional file with the table.
    However I need to create the macro such that when I open a new list of input data, I can execute the macro, leading to the correct output without having to open the additional file with the table.
    I have added an example workbook which shows the idea. Test workbook.xlsx
    Input is the list i get and open, output is the list that should result from the macro. The codes is the list in between, which I need to intergrate somewhere such that I don't have to open it everytime in order run the macro.

    Thanks!

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Creating Unique codes from two columns

    I'm sorry but I am completely lost as to what you are wanting. You keep mentioning macro, but this is a formula we are working with so getting confused.

  9. #9
    Registered User
    Join Date
    07-10-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Creating Unique codes from two columns

    sorry, I clearly didn't explain it very good. I will try again!
    The workfile shows:
    - Input, this is the data I get
    - Output, this is the dataformat as I want to have. Thus I need a macro which can transfrom input format to output format
    - Codes, is the step in between input and output. This is the link between the Account and Counterparty, and the reference number which is necessary in the output.

    The problem is, that I get the inputs in different documents everytime. I then want to run the macro on the new document, get the right output and continue with that. However, for that to work I need to have the codes .xls open, which is not always possible, as the macro will be run from different computers. So I am wondering how to solve this.
    I hope this is more clear?

  10. #10
    Forum Contributor
    Join Date
    07-19-2012
    Location
    Redmond, WA
    MS-Off Ver
    O365
    Posts
    133

    Re: Creating Unique codes from two columns

    Any chance you could change the privacy information so that you could upload files? (I have done this numerous times...)
    I think we generally want to see a starting point, and end result.

    Example:

    Customer - Account - Couterparty
    Cat - Kitty Litter - Dog

    I can create a macro that will output redirect to Excel. As for running a macro without Excel being opened, I am not that advanced yet...
    Last edited by ussenterprise; 07-12-2013 at 02:32 PM.
    Rep is appreciated. Click my * if I helped.

+ 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