?
Solved

IFERROR(VLOOKUP

Posted on 2016-11-01
6
Medium Priority
?
51 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 34

Accepted Solution

by:
Norie earned 2000 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 34

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 34

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

765 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