+ Reply to Thread
Results 1 to 9 of 9

Using VBA's to Eliminate N/A's in a vlookup/index match function

  1. #1
    Registered User
    Join Date
    08-09-2011
    Location
    Colorado Spgs, USA
    MS-Off Ver
    Excel 2008
    Posts
    34

    Using VBA's to Eliminate N/A's in a vlookup/index match function

    Hey guys,

    So, I have an excel file that has a "Master List" tab and in it I have Columns: Company, Industry, Role, Description, Consultants. Then I have a tab for each consultant. I am using the index formula to search for the Company, Industry, Role, Description for each consultant For Example: =INDEX('Master List'!A19,MATCH('John Smith '!$A$1,'Master List'!E19,0)). So basically I want to populate the Consultant tabs with the info I have from my master list. The problem I am running into is that I have to write the formula in the first cell of the consultant tab and then have to drag it down the length of the master experience list to make sure it looks for the consultants name in each row. When it doesn't find that consultant it gives me an N/A or a 0 or a blank (Whatever it is if you use the ISNA or IFError function). I was wondering if there was a way you can suggest that I can delete all these N/A's and just have a clean sheet with just the results that matched, instead of having to delete the N/As or the 0's and that automatically populates the consultant sheets whenever a new row is added to the master list.

    I would have no problem with deleting the blanks, N/A's or O, but this file is going to go around to a number of people that are less willing than I am. My experience in VBA is rudimentary, but I can usually follow the code.

    Thank you for all your help

    S
    Last edited by sush23; 05-30-2013 at 02:16 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Using VBA's to Eliminate N/A's in a vlookup/index match function

    This thread from last week shows how it can be done with 3 basic formulae:

    http://www.excelforum.com/excel-form...xed-value.html

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    08-09-2011
    Location
    Colorado Spgs, USA
    MS-Off Ver
    Excel 2008
    Posts
    34

    Re: Using VBA's to Eliminate N/A's in a vlookup/index match function

    Thank you, I tried doing the above but when I use the data validation by consultant I get a really long list, as a consultant could have worked on more than one client, and I'm not sure how to approach my spreadsheet with your method. I attached a sample file just to give you an idea. There is way more data than that.

    Thank you for your help.

    SSample Experience.xlsx

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Using VBA's to Eliminate N/A's in a vlookup/index match function

    The data validation should be driven from a separate list, which is just a unique list of consultants. I'll set this up for you in your sample file when I've have a coffee break, so I'll post back later.

    Pete

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Using VBA's to Eliminate N/A's in a vlookup/index match function

    Okay, I've added two new sheets to demonstrate this to you. In the Ref_data sheet I've listed the 5 consultants and set up a named range covering Ref_data!$A$2:$A$6. If you have more consultants in your real file then you can add them to the bottom of the list, but you must also adjust the named range. This list is shown in the drop-down in cell C1 of the Select sheet - just click on the down-arrow to select the consultant of interest, and the data will adjust automatically.

    I've sorted your data in Sheet2 in a different order, so that the names were not all bunched together - it doesn't matter what order the records are in. I've added a formula to column H of this sheet which is copied down way beyond your actual data (it doesn't matter how far, but the hyphens are there to help show you). This formula identifies records which meet the criteria (i.e. contains the name of the consultant chosen on the Select sheet), and sets up a unique sequence for those records. Note that the name can be part of a multiple entry in the consultants column.

    In the Select sheet I have also used column H as a helper - this formula finds the row(s) where the records identified on Sheet2 occur. Then I have a straightforward INDEX formula in the main body of the sheet, to retrieve the appropriate data from the main list. You can hide column H on both sheets if you don't want to see them.

    As I said earlier, just choose a consultant from the list in C1 and the data will change automatically.

    I've left your other sheets in the file, though I don't really see a need for individual sheets for each consultant, now that you can just select one from the list.

    Hope this helps.

    Pete
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-09-2011
    Location
    Colorado Spgs, USA
    MS-Off Ver
    Excel 2008
    Posts
    34

    Re: Using VBA's to Eliminate N/A's in a vlookup/index match function

    Pete,
    I'll take a look! Thank you so much for your prompt response and help. I'll keep you posted

  7. #7
    Registered User
    Join Date
    08-09-2011
    Location
    Colorado Spgs, USA
    MS-Off Ver
    Excel 2008
    Posts
    34

    Re: Using VBA's to Eliminate N/A's in a vlookup/index match function

    Pete,
    I'll take a look! Thank you so much for your prompt response and help. I'll keep you posted

    S

  8. #8
    Registered User
    Join Date
    08-09-2011
    Location
    Colorado Spgs, USA
    MS-Off Ver
    Excel 2008
    Posts
    34

    Re: Using VBA's to Eliminate N/A's in a vlookup/index match function

    Pete,

    I implemented your method in my original file, it works wonderfully!! It was so good to actually solve this without having to use code. Thank you again!

    s

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Using VBA's to Eliminate N/A's in a vlookup/index match function

    You're welcome - thanks for feeding back.

    Perhaps you can mark the thread as solved if you think it has been (click on Thread Tools above your first post).

    Pete

+ 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