Solved

IFERROR(VLOOKUP

Posted on 2016-11-01
6
19 Views
Last Modified: 2016-11-01
Hi,

This looks like it should work but doesn't.

   ActiveCell.Formula = "=(IFERROR(VLOOKUP(N2,Sheet3!$A:$B,2,FALSE),"")"

I'm using Excel 2013 and hours of googling says this should work.

Edit: The VLOOKUP works on it's own. I get Runtime error 1004 when I add the IFERROR part.

Thanks,

swjtx99
0
Comment
Question by:swjtx99
  • 3
  • 3
6 Comments
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 41868781
Whenever you have double quotes in the middle of a string in VBA you need to double them up.
ActiveCell.Formula = "=(IFERROR(VLOOKUP(N2,Sheet3!$A:$B,2,FALSE),"""")"

Open in new window

0
 

Author Comment

by:swjtx99
ID: 41868828
Hi Norie,

Thanks. I tried that and get the same results.
0
 
LVL 33

Expert Comment

by:Norie
ID: 41868839
Oops, didn't notice the extraneous ( at the start.

Try this.

ActiveCell.Formula = "=IFERROR(VLOOKUP(N2,Sheet3!$A:$B,2,FALSE),"""")"

Open in new window

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:swjtx99
ID: 41868844
Hi Norie,

Double Double quotes along with another parenthesis did it.

Thanks,

ActiveCell.Formula = "=(IFERROR(VLOOKUP(N2,Sheet3!$A:$B,2,FALSE),""""))"
0
 

Author Closing Comment

by:swjtx99
ID: 41868845
Double quotes worked. Thanks,
0
 
LVL 33

Expert Comment

by:Norie
ID: 41868847
Instead of adding a parenthisis you should remove the one after the = sign.

MInd you enclosing the entire formula in () won't do any harm.:)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now