VLookup Issue

Tooch81

New Member
Joined
May 19, 2011
Messages
6
Since you all were such a big help with my problem yesterday, I have another question for you.

I have a v-lookup statement in my macro and it returns values and #N/A when there is no value, just as expected. The problem is, once I try to use the cells that now have data in them from the v-lookup the macro crashes when I reach a cell with #N/A in it. How can I get the v-lookup to return "" or "0" instead of #N/A? I've tried replacing it but no matter what I do, once I get to the #N/A value in a cell it crashes.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
=if(isna(vlookup("blah blah")),"",vlookup("blah blah"))

ISNA is the test for #N/A

("blah blah") ia obviously your current parameters
 
Last edited:
Upvote 0
So I'm an idiot and keep getting more errors. Can you help me with teh code;

ActiveCell.Formula = "=VLOOKUP(" & Cells(count3 + 26, count2).Address & ",SumData!$A$1:$Z$1000,5,FALSE)"
 
Upvote 0
Ah

did not read initial post carefully enough

VLOOKUP is not good in VBA

The entry you just posted looks great to me

Check your counts because you get errors if reference outside your table in vlookup
 
Upvote 0
Ah

did not read initial post carefully enough

VLOOKUP is not good in VBA

The entry you just posted looks great to me

Check your counts because you get errors if reference outside your table in vlookup


the vlookup wrote works fine, but I'm trying to omit the #N/A's because they are causing problems down the road.
 
Upvote 0
"=VLOOKUP(" & Cells(count3 + 26, count2).Address & ",SumData!$A$1:$Z$1000,5,FALSE)"

this bit Cells(count3 + 26, count2) can be wrapped in an ISNA as in IF(ISNA(Cells(count3 + 26, count2)),0,Cells(count3 + 26, count2))

so you could check that first a trap that possibility



Code:
"=IF(ISNA(VLOOKUP(" & Cells(count3 + 26, count2).Address & ",SumData!$A$1:$Z$1000,5,FALSE))," & """""" & 
", VLOOKUP(" & Cells(count3 + 26, count2).Address & ",SumData!$A$1:$Z$1000,5,FALSE))" 
[code]
 
(that's six dbl quotes "   in the middle )
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,551
Members
452,927
Latest member
rows and columns

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