If(ISNA(VLOOKUP Help... VBA

L

Legacy 313594

Guest
Any advice as to why the below formula isn't working? My goal is supposed to return a "1" if the vlookup identifier is not found (ISNA) & add a 1 to the cell IF the identifier is found (IF, +1).

Any advice? I've pasted what I am working on below

Code:
=IF(ISNA(VLOOKUP(C[-2],'[PBDunkAcc.xlsx]Merrill Accounts'!C3:C5,3,FALSE),"1",VLOOKUP(C[-2],'[PBDunkAcc.xlsx]Merrill Accounts'!C3:C5,3,FALSE))+1,1)

The code that works for me but only adds 1 to the identifier is found is below, in addition to that if the identifier ISNT found I want the #N/A to be 1

Code:
=IF(VLOOKUP(C[-2],'[PBDunkAcc.xlsx]Merrill Accounts'!C3:C5,3,FALSE),VLOOKUP(C[-2],'[PBDunkAcc.xlsx]Merrill Accounts'!C3:C5,3,FALSE)+1,1)
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
When building a formula in VBA, and that formula contains Quote marks, you have to double up those quoute marks..

Try
=IF(ISNA(VLOOKUP(C[-2],'[PBDunkAcc.xlsx]Merrill Accounts'!C3:C5,3,FALSE)),""1"",VLOOKUP(C[-2],'[PBDunkAcc.xlsx]Merrill Accounts'!C3:C5,3,FALSE)+1)
 
Upvote 0
That returns a 1 for every cell, regardless if the identifier is found... I need to it perform 2 arguments.

-If Identifier is present in Column (C[-2]) then return the number +1-This works with the original code
-If Identifier is not present, then return a "1" & NOT #N/A--Original & new code, doesn't work, returns 1 for every cell
 
Upvote 0
What does it do if you just have this

=VLOOKUP(C[-2],'[PBDunkAcc.xlsx]Merrill Accounts'!C3:C5,3,FALSE)+1

I know you'll get #N/A when the identifier is not found in the column (this is troubleshooting, not proposed solution)
But what does it do for the rows that do not return #N/A ?
 
Upvote 0
That returns #N/A for all cells in Column E
That pretty much means none of the identifiers (C[-2]) exist in column 3.
And explains why the previous formula returned 1 for every row.

Check for exact spelling and extra spaces.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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