Simple if statement?

  • Thread starter Thread starter llotto
  • Start date Start date
L

llotto

Can someone write a simple if statement for me?

If D2 is null then P2 is null else P2 =
VLOOKUP(D2,Comments!$A$2:$B$9999,2,FALSE)

I'm looking for something I can simply paste into formula builder. I
am refreshing data from a query, and don't know how many lines I'll
import. If the row is blank as I have it now - the cell has a #N/A in
it - so it causes printing problems. Or is there a better way to
accomplish this?


Thanks in advance.
 
in p2 insert

=if(d2="","",VLOOKUP(D2,Comments!$A$2:$B$9999,2,FALSE))

or

=if(iserror(VLOOKUP(D2,Comments!$A$2:$B$9999,2,FALSE)),"",VLOOKUP(D2,Comments!$A$2:$B$9999,2,FALSE))

the first one works as you described. The second checks if the vlookup
is an error (which #N/A is) and displays nothing if it is and the value
if it is not.
 
Place this formula in P2
IF( IsBlank(D2), "", VLOOKUP(D2,Comments!$A$2:$B$9999,2,FALSE))
 
If by "null" you mean empty, then:

=IF(D2="","",VLOOKUP(D2,Comments!$A$2:$B$9999,2,FALSE))

HTH,
Paul
 
To all - thanks so much - it was the null that needed the "" that was
giving me the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top