# Excel/fromula rewrite

Question
Hi Tom

I cannot seem to make the following formula work:

=if(and(vlookup,a3,Sheet1!\$B\$1:\$C\$159,2,false)=d1,c1=n2),"correct","incorrect")

So, if the product of the vlookup formula is equal to the contents of "d1" and the content of "C1" is equal to the content of "N2" return the word correct otherwise return the word incorrect.

Could you help me with this please?

Chris Mitchell

Chris Mitchell,

=if(and(vlookup,a3,Sheet1!\$B\$1:\$C\$159,2,false)=d1,c1=n2),"correct","incorrect")
should be

=if(and(vlookup(a3,Sheet1!\$B\$1:\$C\$159,2,false)=d1,c1=n2),"correct","incorrect")

but since you seem to imply that your formula is working but the results are not as expected, then that was probably just a typo in your email.

If that is the case, then I agree with your assessment.  You should get "correct" as the return value of the IF function.  If you are not and you think you should, that would normally mean your data is not what you think it is.  You may have a space on the end of a word or something hard to spot that causes equality to fail.

You can test the pieces of the formula

=vlookup(a3,Sheet1!\$B\$1:\$C\$159,2,false)
for example.  Once you determine that is correct, then try

=vlookup(a3,Sheet1!\$B\$1:\$C\$159,2,false)=d1

then
=c1

then
=c1=n2

then you don't get the expected response, then you can further try to see what is the problem.

That is the best I can say given what you have provided.

--
Regards,
Tom Ogilvy

Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Brilliant, thank you

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.