Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need help with VLOOKUP

I want to use VLOOKUP in a few cells. The VLOOKUP function is dependan
on the left adjacent cells. But those cells can also be empty. If the
are, VLOOKUP returns the value #N/A. I want to suppress that result.

I was thinking of using an IF statement like this:

ActiveCell.FormulaR1C1
"=IF(RC[-1]="""","""",=VLOOKUP(B13,rmain!$A$1:$B$2000,2))"


But when I add this I get the following message:

"Runtime error 1004:
Application-define or object-defined error"

What am i doing wrong

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Need help with VLOOKUP

In the worksheet function use IsError and evaluate the
result.

=IF(ISERROR(VLOOKUP(B13,Rmain!
$A$1:$B$2000,2,FALSE)),"None",VLOOKUP(B13,Sheet2!
$A$1:$B$2000,2,FALSE))

If it's any of the Excel error values #DIV/0 or #N/A,
IsError() returns true.

HTH
-Brad

-----Original Message-----
I want to use VLOOKUP in a few cells. The VLOOKUP

function is dependant
on the left adjacent cells. But those cells can also be

empty. If they
are, VLOOKUP returns the value #N/A. I want to suppress

that result.

I was thinking of using an IF statement like this:

ActiveCell.FormulaR1C1 =
"=IF(RC[-1]="""","""",=VLOOKUP(B13,rmain!$A$1:$B$2000,2))"


But when I add this I get the following message:

"Runtime error 1004:
Application-define or object-defined error"

What am i doing wrong?


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Need help with VLOOKUP

You're mixing R1C1 with A1 style references, so I imagine that's causing
some problems. Also, you don't need the equal sign in front of VLOOKUP.
Try this:

ActiveCell.Formula = _
"=IF(" & ActiveCell.Offset(0, -1).Address & _
"="""","""",VLOOKUP(B13,rmain!$A$1:$B$2000,2)) "

--
HTH,
Dianne

I want to use VLOOKUP in a few cells. The VLOOKUP function is
dependant on the left adjacent cells. But those cells can also be
empty. If they are, VLOOKUP returns the value #N/A. I want to
suppress that result.

I was thinking of using an IF statement like this:

ActiveCell.FormulaR1C1 =
"=IF(RC[-1]="""","""",=VLOOKUP(B13,rmain!$A$1:$B$2000,2))"


But when I add this I get the following message:

"Runtime error 1004:
Application-define or object-defined error"

What am i doing wrong?


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Need help with VLOOKUP

I am trying to do a similar thing.
I want the lookup value to be a concatenation of two cells using the
following code that is crashing on run.

ActiveCell.FormulaR1C1 =
"=LOOKUP(E1&""000""&TEXT(D4,""D-MMM-YYYY""),autoReserves!A:A,autoReserve
s!D:D)"

Please post the reply as I cannot recieve emails. Thanks for your effort
and knowledge

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Need help with VLOOKUP

If you're using formular1c1, you have to write your formula using R1C1 reference
style.
But it looks like just changing to:

activecell.formula = ....

should work.

Elinor Hartman wrote:

I am trying to do a similar thing.
I want the lookup value to be a concatenation of two cells using the
following code that is crashing on run.

ActiveCell.FormulaR1C1 =
"=LOOKUP(E1&""000""&TEXT(D4,""D-MMM-YYYY""),autoReserves!A:A,autoReserve
s!D:D)"

Please post the reply as I cannot recieve emails. Thanks for your effort
and knowledge

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Need help with VLOOKUP



Please post the reply as I cannot recieve emails. Thanks for your effort
and knowledge

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
If (Vlookup 0) working, but what if Vlookup cell does not exist Steve Excel Worksheet Functions 18 November 18th 09 07:33 PM
Vlookup in vlookup - taking the result as array name SupperDuck Excel Worksheet Functions 2 June 2nd 07 11:05 AM
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP buffgirl71 Excel Discussion (Misc queries) 12 November 14th 06 11:36 PM
Vlookup -=VLOOKUP(F9,LookUp1!$A$2:$B$1504,2,FALSE) MikeR-Oz New Users to Excel 1 March 22nd 06 09:01 AM
Vlookup info being used without vlookup table attached? Excel Worksheet Functions 0 January 25th 05 10:43 AM


All times are GMT +1. The time now is 05:54 PM.

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

About Us

"It's about Microsoft Excel"