Lookup

Copper Contributor

Hello.  I am working with a Lookup function.  The lookup vector is in the left column, and the return in a column to the right, the function area includes the entire lookup vector and return vector.  The formula is repeated down a column and is correct for each entry, not copied where the value of the vector area or return area changes.  Many returns for the value entered are correct, but some entries do not return the correct value.  

The evaluation also returns the incorrect value.  

The formatting is the same for all entries in the columns.  

An evaluation formula returns the correct values for each of the cells in the formula.

Nonetheless, the return value of the lookup is incorrect.  

Any suggestions for correcting this problem?

 

 

Thank you.

 

4 Replies

@Deeann_Speigle 

Kindly attach you sample file.

@Twifoo 

 

Okay.  Here is a screen shot of the data, the actual workbook is included as attachment.  The sheet is rather messy, sorry.  It is a work in the initial stages.

lookup function.png

 

Here is a screen shot of the worksheet.  column A is a reference or catalogue number, column B is the value of the item in column A.  In column G the reference number is entered, this also the number that is used in the lookup function that is in column H.  The expected return is the number corresponding to the reference number.  In column F an x marks the incorrect returns for the lookup value entered.  

 

The sheet was created to list food items and calorie values in columns A, B respectively.  So, when a food item is entered in column G, the return is the correct calorie number associated with the food item.  For example, A2 is 1/2 cup of oats and B2 defines the total calories as 150.

 

When an incorrect value was returned, I entered 0s for all of the blank values in column B.  Then I checked formatting, copy and paste error (because I used the same formula for all of column H), then I checked the value entered with a true/false function, then I rewrote the function to include only 200 values in the lookup and return columns (I wasn't sure if there was a limit to the lookup function). 

 

Not sure what else to try.   

  

 

@Deeann_Speigle Use VLOOKUP in stead. In H1, and copy down.

=VLOOKUP(G1,$A$1:$B$198,2,0)

In order for LOOKUP to work, the lookup range need to be sorted.

 

Alternatively, use XLOOKUP.

=XLOOKUP(G1:G14,A1:A198,B1:B198,,0,1)

 

@Riny_van_Eekelen 

 

Ooh, that is fun.  Thank you!