Get rid of #N/A

adamsm

Active Member
Joined
Apr 20, 2010
Messages
444
HI,

The following formula in the worksheet module displays #N/A when no match can be found.

Code:
Me.Cells(nextRow, "H").Formula = "=VLOOKUP(C" & nextRow & _
                    ",'Price Range'!A4:K51,11 ,FALSE)"

How could I make the formula not to display the #N/A even no match can be found. Instead leave the column blank.

Any help on this would be kindly appreciated.

Thanks in advance.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Thanks for the reply. Should it be as follows?
Code:
 Me.Cells(nextRow, "H").Formula = "=IFERROR(VLOOKUP(C" & nextRow & _
                    ",'Price Range'!A4:K51,11 ,FALSE)"
 
Upvote 0
Nearly, you need a...

,"")


... At the end I belived. This would put in a blank if it errors.
 
Upvote 0
could also use
Code:
Me.Cells(nextRow, "H").Formula = "=IF(ISNA(VLOOKUP(C" & nextRow & _
                    ",'Price Range'!A4:K51,11 ,FALSE),"""",VLOOKUP(C" & nextRow & _
                    ",'Price Range'!A4:K51,11 ,FALSE)))"
 
Upvote 0
How about the following version. Is this what you meant?

I would be happy if you could reply me with the whole formula.

Code:
                    Me.Cells(nextRow, "H").Formula = "=IFERROR(VLOOKUP(C" & nextRow & _
                    ",'Price Range'!A4:K51,11 ,FALSE),"")"
 
Upvote 0
Could you tell us exactly what you're trying to do with the code, at first glance it would appear that you're re-writing a range of formula triggered by an event change, which sounds like a waste of system resource.

There may be a more efficient way to do what you're trying.
 
Upvote 0
Looks good - give it a go...



Rich (BB code):
Me.Cells(nextRow, "H").Formula = "=IFERROR(VLOOKUP(C" & nextRow & _
                    ",'Price Range'!A4:K51,11 ,FALSE),"""")"

looks better, but as I mentioned, it also looks inefficient.
 
Upvote 0
jasonb75. The formula you posted at your last reply seems to be working for me.

But could you define me why you said "it also looks inefficient"?
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top