Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Simple if statement?

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Simple if statement?

in p2 insert

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

or

=if(iserror(VLOOKUP(D2,Comments!$A$2:$B$9999,2,FAL SE)),"",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.


wrote:
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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default Simple if statement?

If by "null" you mean empty, then:

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

HTH,
Paul

wrote in message
ps.com...
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.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Simple if statement?

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


PCLIVE (RemoveThis) wrote:
If by "null" you mean empty, then:

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

HTH,
Paul

wrote in message
ps.com...
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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple IF statement Bob[_16_] Excel Discussion (Misc queries) 4 March 30th 10 07:12 PM
Simple IF statement Steve Douglas P2p, MCP Excel Worksheet Functions 4 September 10th 07 12:32 PM
Simple If Statement digital21st Excel Worksheet Functions 2 August 2nd 06 03:57 PM
Simple IF statement Patti[_2_] Excel Programming 2 July 2nd 05 04:49 PM
Simple If Statement DM Excel Programming 2 July 27th 04 08:26 PM


All times are GMT +1. The time now is 03:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"