Need help with value return with Yes and No

gd6noob

Board Regular
Joined
Oct 20, 2017
Messages
170
Office Version
  1. 2016
Platform
  1. Windows
What I want to do is have a Yes or No under the Eligible Superstar column (first pic), using the names on the second pic.
So if the name in A3 of the first pic is on the list in the second pic, then Yes in G3, if the name isnt on the list, then No in G3.

Is this possible?

Thanks

ejX1R3o.jpg


llzoryo.jpg
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
use a vlookup or index match
and if you get a return its correct

=vlookup(A3, Range of 2nd pic , 1, 0)
then
If (iserror (vlookup(A3, Range of 2nd pic , 1, 0)) , "NO", "YES" )

but we need sheet name and range to give the full formula
 
Upvote 0
Assuming first pic is Sheet1 and second pic is Sheet2, try:
Code:
Sub matchNames()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Sheets("Sheet1").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim rName As Range
    Dim foundName As Range
    For Each rName In Sheets("Sheet1").Range("A3:A" & LastRow)
        Set foundName = Sheets("Sheet2").Range("B:B").Find(rName, LookIn:=xlValues, lookat:=xlWhole)
        If Not foundName Is Nothing Then
            rName.Offset(0, 6) = "Yes"
        Else
            rName.Offset(0, 6) = "No"
        End If
    Next rName
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
use a vlookup or index match
and if you get a return its correct

=vlookup(A3, Range of 2nd pic , 1, 0)
then
If (iserror (vlookup(A3, Range of 2nd pic , 1, 0)) , "NO", "YES" )

but we need sheet name and range to give the full formula

Sry, same workbook but different sheet.

Assuming first pic is Sheet1 and second pic is Sheet2, try:
Code:
Sub matchNames()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Sheets("Sheet1").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim rName As Range
    Dim foundName As Range
    For Each rName In Sheets("Sheet1").Range("A3:A" & LastRow)
        Set foundName = Sheets("Sheet2").Range("B:B").Find(rName, LookIn:=xlValues, lookat:=xlWhole)
        If Not foundName Is Nothing Then
            rName.Offset(0, 6) = "Yes"
        Else
            rName.Offset(0, 6) = "No"
        End If
    Next rName
    Application.ScreenUpdating = True
End Sub
Sry, Im a very beginner excel user, where do I put this in?
 
Upvote 0
Do the following: Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the menu at the top click 'Insert' and then click 'Module'. Copy and paste the macro into the empty code window that opens up. Press the F5 key to run the macro. Close the code module window to return to your sheet. There are other quicker ways to run the macro such as assigning it to a button that you would click on your sheet or assigning it to a short cut key. Change the sheet names in the code to match yours if necessary.
 
Upvote 0
Do the following: Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the menu at the top click 'Insert' and then click 'Module'. Copy and paste the macro into the empty code window that opens up. Press the F5 key to run the macro. Close the code module window to return to your sheet. There are other quicker ways to run the macro such as assigning it to a button that you would click on your sheet or assigning it to a short cut key. Change the sheet names in the code to match yours if necessary.
Thank you very much, this worked.
 
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,603
Members
452,658
Latest member
GStorm

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