If with Vlookup

pedroc

New Member
Joined
Jul 20, 2011
Messages
22
Hi all,

I have the following function

=IF(B36=VLOOKUP(B36,Sheet2!$A$1:$A$60,1,TRUE),"Yes","X")

the function has been copied across a number of cells so that when a correct answer listed in the range on sheet 2 is entered a "Yes" should appear in column C.

However this function seems to randomly returning the "X" value even when the answer is correct. and on other occasions is returning nothing at all.

Have tried changing the true statement to false but this appears to be just as random.

Can anyone suggest a fix for this or an alternative function.

Many thanks

pedroc
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Change True to False in Vlookup.
I know you have already done it as you say but at the movement that seems to be the only problem.
And what do you mean it returns nothing at all?
Does it returns #N/A or just completely blank?
 
Upvote 0
I think what you need is Isna formula. Try this:


=IF(ISNA(VLOOKUP(B36,Sheet2!$A$1:$A$60,1,FALSE)),"X","YES")
 
Upvote 0
Change True to False in Vlookup.
I know you have already done it as you say but at the movement that seems to be the only problem.
And what do you mean it returns nothing at all?
Does it returns #N/A or just completely blank?


Sorry - yes it returns N/A
 
Upvote 0
Hi please provide data source and also your expected result. Provide a simple sample.

Hi Villareal

the data source is just a list of 60 correct answers stored on sheet 2 A1:A60.

this function has been placed in column C on sheet 1 in the cell next to where a user can input their answer. the result being a Yes displayed if they have the correct answer and a X displayed if they are incorrect.
 
Upvote 0
Is there any duplicate values in table array under the Vlookup? If that is the case, you will not get the right answer. For ex.
Excel Workbook
CDEF
30LookupTableLookupValueReturnValue
31111
322
333
341
352
363
Sheet1
Excel 2010
Cell Formulas
RangeFormula
F31=VLOOKUP(E31,C31:C36,1,FALSE)


You really dont know whether the returnValue refers to row 31 or 34.
 
Upvote 0

Forum statistics

Threads
1,215,346
Messages
6,124,417
Members
449,157
Latest member
mytux

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top