Hi all
I would like to search a Excel List of names(voters Registration list) by typing a name to see if that person is registered. Can anyone advice me how to do it or provide me with a sample program
Many thanks

Dani AI

Generated

A clear, low-effort way to let someone type a name and check registration is to add a single "search" cell and use simple worksheet formulas or Excel's built‑in Find/Filter. 's VBA approach is valid for custom behavior, but the common tasks below are usually faster to implement without macros and handle most voter-list scenarios.

Exact-match and contains tests (place the lookup name in A1; replace NamesRange with the column range or table column):

=IF(COUNTIF(NamesRange, A1)>0, "Registered", "Not registered")

Contains (substring) test:

=IF(COUNTIF(NamesRange, "*" & A1 & "*")>0, "Registered", "Not registered")

Case-sensitive exact match:

=IF(SUMPRODUCT(--EXACT(NamesRange, A1))>0, "Registered", "Not registered")

Return row or record (older Excel: MATCH; newer Excel: XLOOKUP):

=IFERROR(MATCH(A1, NamesRange, 0), "Not found")

Practical steps and troubleshooting tips:

  • Convert the list to an Excel Table (Ctrl+T) so structured references auto-expand.
  • Clean names first: remove leading/trailing spaces and nonprintable characters with TRIM and CLEAN, and normalize non-breaking spaces if present.
  • If first/last names are separate, use COUNTIFS or create a helper key (e.g., First&"|"&Last) for robust lookups.
  • For very large lists, avoid looping cell-by-cell in VBA; prefer Range.Find, Application.Match, AutoFilter, or helper keys for performance.

For near-matches (typos, different spelling), use Power Query fuzzy-merge or the Microsoft Fuzzy Lookup add-in. Because this data contains personal information, apply appropriate access controls and work on a copy when testing. For a VBA alternative, see 's suggestion in the thread.

Recommended Answers

All 2 Replies

Try the following, in your macro -

Function TextExtract(ByVal strSearchFor, ByVal Target As Variant) As String
Dim OneCell As Range

   TextExtract = ""
   If TypeName(Target) = "Range" Then
     For Each OneCell In Target
       If InStr(1, OneCell.Text, strSearchFor, vbTextCompare) > 0 Then
         TextExtract = strSearchFor
         Exit For
       End If
     Next OneCell
   ElseIf TypeName(Target) = "String" Then
     If InStr(1, Target, strSearchFor, vbTextCompare) > 0 Then TextExtract = strSearchFor
   End If

End Function

Example Usage (As a worksheet function):

=TextExtract("3b",A40:A46)
''3b will be the text searched for...

It does not return which cell in the range contains the text. In the case shown only cell A43 contained "3B". This function will search the text sequentially until the condition is true then it will stop searching. Text search will work the same way.

Note that this function is not case sensitive. It will not return how many times the text is present. A modification can be made to have the function count how many cases of the text appear.

Please read more from link with some more sample code...

hi Industrious poster
Thanks for the response. I will try it later and get back

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.