+ Reply to Thread
Results 1 to 14 of 14

Need Help with Vlookup and Index Functions to Solve for Error

  1. #1
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Need Help with Vlookup and Index Functions to Solve for Error

    I need help with a formula using a combination of vlookup and index functions that solves for empty cell in the range I need to index. In the attached workbook, Example A displays a range from B7 to D12 that I need to use the vlookup/index formula beginning in F7 to find the lowest value (range D7:d12) and sort that range from lowest to highest value. Cells beginning in G7 and H7 apply the same technique but index for different values.

    My issue is that when I expand the range and which includes blank cells (Example B) and using the same formulas, the formula returns an error in F7. I assume this is because the formula in F7 does not consider how to treat blank cells in the range I’m seeking to index.

    Please suggest modifications to the formulas in F7, G7, and H7 to can accommodate empty cells in the range I am attempting to index. I've attached a sample workbook below. Thanks!Vlookup and Index Sample.xlsx

  2. #2
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    I would solve your problem this way:
    F7 enter and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    G7 enter and fill across and down.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  3. #3
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    NDM, thank you! this is a much more efficient manner to get the sort task accomplished. However, if one of the rows in the range D7:D12 is blank, then the formula returns a #NUM! error. In addition of one of the cells in column B or C is blank the corresponding formulas return a zero. I would like the forumula to be able to disregard blank cells within the range and only sort and return what is entered. Thoughts?

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    I think that I have covered your concerns with the formulae in the enclosed file. I did example B including the blank rows and I also did example B to include up to row 32.

    From these examples, you should be able to decide what you need for your purposes.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    Thanks. I will take a look and follow up.

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    Sorry, didn't see the blank cell requirement. This addresses that.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    Everything looks great except for the display beginning in K16 on your sample. Rather than displaying the rank in column K for each value, I would like the original number from column D displayed (in this case 15). Also, I failed to specify earlier that the rank order arguement for Column D would be from lowest to highest. I'm not sure how to change the order arguement in the Helper column.

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    There are two helper columns. The first ranks the values in column D (breaking ties). The second helper column puts the ranks in order so that the values can be used to return the actual values from column D
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    Okay, this looks like it will do the job. Can't thank you enough for your help!

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    Thank you for the feedback.

  11. #11
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    Newdoverman (or anyone),

    I have applied your solution (in the lower portion of this thread) for ranking results using the Index/Match functions to a different situation. I have attached a sample spreadsheet that includes the requisite formulas and helper columns. The issue is that the results of the ranking do not appear to consider when there are two or more values that are the same. I’ve highlighted the occurrences in the sample spreadsheet (specifically for players 12 and 15) where I would have expected the ranking results to display player 17 (to display as tied with player 12) and player 19 (to display as tied with player 15).

    Would you please take a look and advise on the adjustments to the formulas that are required?
    Attached Files Attached Files

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    In helper 2 column, you have this,,,
    =IF(E5="","",IF(F5<H$1,"",RANK(E5,$E$5:$E$44,1)+COUNTIF($E$5:E44,E5)-1))
    it needs to be this...
    =IF(E5="","",IF(F5<H$1,"",RANK(E5,$E$5:$E$44,1)+COUNTIF($E$5:E5,E5)-1))

    What this is doing is counting - from E5 - how many times a specific number appears, then adds that cumulative value (minus 1) to the Total, for the ranking
    Last edited by FDibbins; 05-22-2015 at 03:41 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  13. #13
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    Thank you for your reply, explanation and fix. It solved the problem. I will pay closer attention next time, but you did help get out of a jam here. Thanks agains.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Need Help with Vlookup and Index Functions to Solve for Error

    Happy to help and thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Intriguing error regarding index/match functions
    By AlanY in forum Excel General
    Replies: 2
    Last Post: 12-11-2014, 10:14 AM
  2. Not sure if I should use multiple vlookup, index or IF functions
    By nickiv in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-20-2013, 11:29 AM
  3. error using index and match functions in macro
    By skalaima in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-10-2013, 04:20 PM
  4. Can't find the error functions INDEX () and SMALL()
    By HyperG in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2012, 12:20 AM

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