+ Reply to Thread
Results 1 to 7 of 7

Can a macro recognize a number and then preform 2 tasks?

  1. #1
    Registered User
    Join Date
    08-22-2009
    Location
    londonengland
    MS-Off Ver
    Excel 2007
    Posts
    12

    Can a macro recognize a number and then preform 2 tasks?

    Over the weekend I had to look at 220 strings of numbers, some strings with as much as 20 numbers and determine if the numbers represented red, green, blue, or yellow and how many of each color from a parent list. I did it all by hand. After getting help here from JBeaucaire on my tally sheet, which I successfully recreated with their guidance, I thought I might ask this question. How would one go about creating a macro that would when it seen a certain number, it would put the color in the column immediately to the left, and the number of colors in the column immediately to the left. I am new to excel so I don't know if this is even possible. Thanks for any guidance someone may provide.
    Last edited by Nemo5; 08-29-2009 at 08:40 AM.

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

    Re: Can a macro recognize a number and then preform 2 tasks?

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

  3. #3
    Registered User
    Join Date
    08-22-2009
    Location
    londonengland
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Can a macro recognize a number and then preform 2 tasks?

    Here is an example of what I was wondering the outcome could be.
    Attached Files Attached Files

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

    Re: Can a macro recognize a number and then preform 2 tasks?

    There's not really anything to go on from here I'm afraid... what does each column represent, how are the various values to be determined etc ... it's very hard to ever offer too much information.

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

    Re: Can a macro recognize a number and then preform 2 tasks?

    Be sure to post examples of BEFORE/AFTER so everyone can see where you started and where you ended. Only way we can know what's going on here.
    _________________
    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!)

  6. #6
    Registered User
    Join Date
    08-22-2009
    Location
    londonengland
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Can a macro recognize a number and then preform 2 tasks?

    I am uploading a new workbook to hopefully explain what I would like to do. Sheet 1 has 12 cartons listed. When I am done making list there will be 500. Sheet 2 has carton with what part is in it but not how many of each part or color. This is an example. There will actually be around 20 cartons per sheet. Sheet 3 is what I would like to have happen. From the information on sheet 1, is there a simple macro that would populate the parts and color column of sheet 2 to look like sheet 3.
    Attached Files Attached Files

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

    Re: Can a macro recognize a number and then preform 2 tasks?

    This is a normal INDEX/MATCH approach:

    A2:
    =INDEX(Sheet1!$B:$B, MATCH(B2, Sheet1!$A:$A, 0))
    C2:
    =INDEX(Sheet1!$C:$C, MATCH(B2, Sheet1!$A:$A, 0))

    Copy down, then copy each over the other set.
    Attached Files Attached Files

+ 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