Forestq

Active Member
Joined
May 9, 2010
Messages
482
Hi,

how to change vlookup that instead for found value, put just "yes" ?

Code:
Dim rng, stullpath As String
rng = ws2.Range("A4:" & Range("B4").End(xlDown).Address).Address
    
sfullpath = "[" & ws2.Parent.Name & "]" & ws2.Name


ws1.Range("A1").Select
x_rows_vlookup = Application.WorksheetFunction.CountA(Columns(2))
x_rows_vlookup = x_rows_vlookup - 1
ws1.Range("C2").Select
                    
ActiveCell.Formula = "=IF(ISNA(VLOOKUP(B2,'" & sfullpath & "'!" & rng & ",1,0)),""NO"",VLOOKUP(B2,'" & sfullpath & "'!" & rng & ",1,0))"


Selection.AutoFill Destination:=Range("C2:C" & x_rows_vlookup), Type:=xlFillDefault
                    
Range("C2:C" & x_rows_vlookup).Select
Selection.Copy
Range("C2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
You've got your IF(ISNA test to determine if the VLOOKUP is working. If it isn't working, put "No". If it is, put "YES". If I've understood you correctly, couldn't you just completely remove the second VLOOKUP and replace it with "YES"?
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,238
Members
448,555
Latest member
RobertJones1986

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