search and display names

HeRoseInThree

Board Regular
Joined
Jan 11, 2018
Messages
103
My company hires few people, yet many apply. That being said, I would like to sort through the list of applicants to determine if they have previously applied as to not waste time on someone that we have chosen not to hire.

I'd like to search their name in a cell (k12) and have it display a cell is the reason we passed.

I have tried a vlookup formula, an index formula as well as find and search respectfully.

Any help would be greatly appreciated!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You can put some examples with fictitious data of how your data is on the sheets.
 
Upvote 0
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]b[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]John Smith[/TD]
[TD]Lives in the wrong area[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jim Davis[/TD]
[TD]no CDL[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]John Doe[/TD]
[TD]multiple speeding violations[/TD]
[/TR]
</tbody>[/TABLE]


This list is hundreds of names long. If I have a search box in h1, I'd like to be able to type John and have a result list of any and all names John displayed (column b) as well as the description of why we didn't hire them (column c).
 
Upvote 0
Following your example: names in B, description in C.
Write a name in H1 and the result will be in H2 and I2 down.
Put the following macro in the events of your sheet.


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count > 1 Then Exit Sub
  If Target.Address(0, 0) = "H1" Then
    Range("H2:H" & Rows.Count).ClearContents
    If Target.Value = "" Then Exit Sub
    Dim a() As Variant, b As Variant, i As Long, n As Long
    a = Range("B1:C" & Range("B" & Rows.Count).End(xlUp).Row).Value
    ReDim b(1 To UBound(a, 1), 1 To 2)
    n = 1
    For i = 1 To UBound(a)
      If InStr(1, LCase(a(i, 1)), LCase(Target.Value)) > 0 Then
        b(n, 1) = a(i, 1)
        b(n, 2) = a(i, 2)
        n = n + 1
      End If
    Next
    Range("H2").Resize(UBound(b), 2).Value = b
  End If
End Sub

SHEET EVENT
Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.
 
Upvote 0
I pasted it into the correct area. I received an error.
The value you entered is not valid.

A user has restricted values that can be entered into this cell.
 
Upvote 0
For me, DanteAmor's cod works very good.

A user has restricted values that can be entered into this cell.

Sound like you have a DV in H1:In

Ooops forget to refresh...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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