简体   繁体   中英

Inconsistent Excel VLOOKUP

I have an odd problem with some formulas in my Excel sheet for fantasy football:

In one table, I have a list of the picks and players drafted in one year. The columns are as follows: CO = Player name, CP = Year, CQ = Round, CR = Pick, CS = Owner.

Column CO is hand-entered with names, CP is hand-entered with the year 2011, and CQ is hand-entered with the draft round (the first ten are round 1, the second ten are round 2, etc).

Column CR is a formula that calculates the pick number based on the round number and the row it's in. The formula in cell CR2 looks like this: "=CQ2+MOD(ROW(CR2)-2,10)/100+0.01" and evaluates to "1.01". CR3's formula would evaluate to "1.02", CR4 would evaluate to "1.03", etc.

EDIT: Here's a picture of the top 15 rows of this sheet: picks sheet here

On another sheet, I have a 5x10 grid of VLOOKUP formulas where I try to list which owner has which picks. The VLOOKUP formula for each of the cells in this grid is as follows: "=VLOOKUP(1.01,Picks2011[[Pick]:[Owner]],2,FALSE)", where "1.01" is the name of the pick from column CR, "Picks2011" is the name of the table in the previous sheet, and "[[Pick]:[Owner]]" are the columns in the table "Picks2011". This example formula correctly outputs the name of the owner who had pick 1.01 in 2011.

EDIT: Here's a picture of the grid with the failing cells: grid showing the errors

The problem is that certain cells in this sheet are giving me an "#N/A" for no particular reason. For example, pick 2.01 outputs correctly, but pick 2.02 outputs #N/A, and pick 2.03 outputs correctly again. There doesn't seem to be any kind of a pattern to the errors. I've tried deleting both tables and recreating them from scratch, and I can't seem to figure out what's wrong with them.

Travis... I noticed that the VLOOKUP formula is pointing to a grid formatted as a table, which I love since it makes it easier than having to deal with specifying and anchoring ranges.. however, the fact that the N/A issue you are running into appears to happen every other row, makes me wonder if the formatting on those culprit rows is different than the formatting on those rows returning the values you'd expect. Maybe check that, and as a way of troubleshooting try copying data from the working rows into the failing rows to see what value your vlookup returns.. worth the shot.

Take a look at using an INDEX(MATCH) construct instead of VLOOKUP .

Unfortunately VLOOKUP behaves pretty unpredictably if you're not working with just two columns of unique strings.

I wrote an answer here ( Excel - How do programmatically convert 'number stored as Text' to Number? ) which may be just what you're looking for!

INDEX ( <return array> , MATCH ( <lookup value> , <lookup array> , 0) )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM