+ Reply to Thread
Results 1 to 6 of 6

Add machine type next to machine number

  1. #1
    Registered User
    Join Date
    01-25-2009
    Location
    MI
    MS-Off Ver
    Excel 2003
    Posts
    11

    Add machine type next to machine number

    I would like to make a nested If statement macro. I have 28 machine names R1-R28, I want to automatically insert the machine type next to the name. I.e. if R1,R5,R8 then 'Hartford 10' would need to be inserted in the cell next to the name. if R10,R22,R23 then 'Hartford 20' and so on.

    I can alter the code just need to figure out the basic structure to insert the string into the adjacent cell.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Add machine type next to machine number

    Hello Trishay321,

    Without seeing the layout of the workbook I can only offer a guess as to what you need. This appears to be simple lookup problem. What you have tried so far? Can you post a copy of the workbook?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Add machine type next to machine number

    I don't know without seeing your layout whether or not the following will work for you or even if it meets your criteria but try something like
    Please Login or Register  to view this content.
    You may need to upload a mock workbook with mock data (nothing personal or sensitive) in order to do exactly what you want.


    EDIT: You beat me to it Leith
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Registered User
    Join Date
    01-25-2009
    Location
    MI
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Add machine type next to machine number

    The first column is the machine name, I want to run the macro to fill in the type in the column next to it, so I was working on a bunch of if statements but there are 20 machine types.

    R1 Hartford 10
    R12 GW Menn 120
    R10 Hartford 20
    R11 Hartford 40

    I had =IF(OR(A2="R1",A2="R5",A2="R8"),"Hartford 10", " ") to start but I will need something for each machine name and not sure how to put them all together in a macro.

    I want the second column to populate itself with the macro.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Add machine type next to machine number

    Hello Trishay321,

    This workbook make help make this clearer. There are 2 worksheets: Machines and Lists. Lists contains 2 named ranged ranges "Machine_Number" and "Machine_Type". A formula on "Machines" looks up the machine number in column "A" and returns the machine type in column "B". Here is the formula that is used...

    =IF(INDEX(Machine_Type,MATCH(A2,Machine_Number,0))=0,"",INDEX(Machine_Type,MATCH(A2,Machine_Number,0)))
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-25-2009
    Location
    MI
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Add machine type next to machine number

    Perfect thanks! I knew it could be simple.

+ 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