homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums


Post New Topic  New Poll  Post A Reply
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums   » Other Geeky Stuff   » Ask a Geek!   » If Statement Help

 - UBBFriend: Email this page to someone!    
Author Topic: If Statement Help
Quincy
Single Celled Newbie
Member # 39479

Rate Member
Icon 11 posted June 15, 2011 10:41      Profile for Quincy     Send New Private Message       Edit/Delete Post   Reply With Quote 
I have the following formula in cell D2: =Vlookup($C2,Indirect($A2),3,0) and it works fine. However because of a special case I need to check cell B2 input and added the following if statement: =IF($B2<>"L",Vlookup($C2,Indirect($A2),3,0),"Text String"). Unfortunately, I do not get the desired result. If B2=L, I get the text string; however, if I enter A or B (the other two choices) I get #N/A. I don't understand, and wonder if you can shed some light on the apparent problem.

Quinc

Posts: 3 | From: Utah | Registered: Jun 2011  |  IP: Logged
GrumpySteen

Solid Nitrozanium SuperFan
Member # 170

Icon 1 posted June 15, 2011 11:31      Profile for GrumpySteen     Send New Private Message       Edit/Delete Post   Reply With Quote 
When you have a problem like this, it's useful to try googling keywords that relate to what you're doing... an if() function in Excel returning #NA, for example, can be condensed to Excel if #NA

The first result seems likely to be the answer you're looking for, but there are other search results that have useful information too.

--------------------
Worst. Celibate. Ever.

Posts: 6291 | From: Tennessee | Registered: Jan 2000  |  IP: Logged
Quincy
Single Celled Newbie
Member # 39479

Rate Member
Icon 1 posted June 15, 2011 14:47      Profile for Quincy     Send New Private Message       Edit/Delete Post   Reply With Quote 
Thank you, Grumpy, for your reply. I'm not sure it is helpful, however. The VLOOKUP function worked prior to adding the IF statement. The IF statement seems to be properly formed, but when I added it, the VLOOKUP function gave the #NA result. I'm trying to determine what happened when I added the IF statement. Is there a problem with it, and if not how did it change the VLOOKUP function?
Posts: 3 | From: Utah | Registered: Jun 2011  |  IP: Logged
dragonman97

SuperFan!
Member # 780

Member Rated:
4
Icon 1 posted June 15, 2011 16:14      Profile for dragonman97   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
Debugging 102: Break your problem into small problems.
Put almost each part of your formula into a different cell, and chain them.

Once you understand how Excel is evaluating each statement, you may figure out that something isn't actually correct...and/or that you need to use another formula to get the desired results.

--------------------
There are three things you can be sure of in life: Death, taxes, and reading about fake illnesses online...

Posts: 9039 | From: Westchester County, New York | Registered: May 2001  |  IP: Logged
The Famous Druid

Gold Hearted SuperFan!
Member # 1769

Member Rated:
4
Icon 1 posted June 15, 2011 18:14      Profile for The Famous Druid     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by dragonman97:
Debugging 102: Break your problem into small problems.

Sounds like good advice.

/me grabs machete

/me wanders off in search of a certain user...

--------------------
If you watch 'The History Of NASA' backwards, it's about a space agency that has no manned spaceflight capability, then does low-orbit flights, then lands on the Moon.

Posts: 10313 | From: Melbourne, Australia | Registered: Oct 2002  |  IP: Logged
Ugh, MightyClub
BlabberMouth, the Next Generation
Member # 3112

Member Rated:
5
Icon 1 posted June 16, 2011 06:29      Profile for Ugh, MightyClub     Send New Private Message       Edit/Delete Post   Reply With Quote 
VLOOKUP() will return #N/A if the lookup value ($C2 in your case) is either blank or is not found in the lookup table (INDIRECT($A2) in your example).

Try putting just the VLOOKUP piece of the formula in another column of the same row and see if you get the expected result in that column but *not* the column with the IF() version.

There is nothing I've ever heard of that would make VLOOKUP() (or any other function) behave differently when embedded in an IF().

In fact, this page suggests putting VLOOKUP() in an IF() construct to hide the #N/A when it happens: http://pubs.logicalexpressions.com/pub0009/LPMArticle.asp?ID=446

--------------------
Ugh!

Posts: 1613 | From: Ithaca, NY | Registered: Dec 2004  |  IP: Logged
Quincy
Single Celled Newbie
Member # 39479

Rate Member
Icon 1 posted June 16, 2011 17:12      Profile for Quincy     Send New Private Message       Edit/Delete Post   Reply With Quote 
Thank you for your replies. I discovered that the problem was I data validated (referenced) a table on a separate worksheet. Moving it solved my problems. Again, Thank you.
Posts: 3 | From: Utah | Registered: Jun 2011  |  IP: Logged


All times are Eastern Time  
Post New Topic  New Poll  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

© 2011 Geek Culture® All Rights Reserved.

Powered by Infopop Corporation
UBB.classicTM 6.4.0



homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam