I'm using VLOOKUP to search for results in another worksheet. What I need is 0 returned if the search fails. Currently I'm getting #N/A and that's causing my other formulas to fail.
Any suggestions???
TIA
I'm using VLOOKUP to search for results in another worksheet. What I need is 0 returned if the search fails. Currently I'm getting #N/A and that's causing my other formulas to fail.
Any suggestions???
TIA
Last edited by Tanasi; 03-27-2009 at 12:04 PM.
A couple...
=IF(ISNA(VLOOKUP(....)),0,VLOOKUP(....))
or assuming results of VLOOKUP when found are numeric then another alternative:
=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,VLOOKUP(...)))
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
In the first suggestion simply replace the references to VLOOKUP(...) with your own VLOOKUP, ie:
=IF(ISNA(VLOOKUP(C1,'Import-A'!A:H,3,0)),0,VLOOKUP(C1,'Import-A'!A:H,3,0))
Note: given you're pulling Column C you need not reference A:H you could just reference A:C thereby reducing dependencies... you could use INDEX/MATCH to reduce further but that's for another day.
=--existing formula
assumes results either numeric or logical (boolean true / false)
Apparently I thought this solved too soon.
My current formula:
=VLOOKUP(A1,'IMPORT-1'!A:C,3)
no longer returns #N/A when the value in A1 isn't found in IMPORT-1 but instead returns the previous found value in the same column.
What I need is if not found to get a 0(zero) and if found the value in that cell.
I'm not married to VLOOKUP I just need something that works.
TIA
Anyone would think this was rocket science..
-- existing formula
means
=--IF(ISNA(VLOOKUP(A2,'Import-A'!A:C,3,0)),0,VLOOKUP(A2,'Import-A'!A:C,3,0))
using VLOOKUP withoug 0/FALSE as 4th argument will return different results - I would advise you check out XL Help on the VLOOKUP function.
Thanks, Now I understand what you were previously saying.
Sorry to have bothered you, I shall refrain in the future.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks