How do I make a customer list appear in a search from the name in Excel?

Asked

Viewed 84 times

2

I have a client list; I want to do a search where you type in part of the customer’s name and then appear all the customers who have that name. Example:

Social Status of Clients: João da Silva ME; Mariazinha Me; João Vitor ME; ...

Desired search: John

The result should appear all customers who have John in the social reason. How do I do this in Excel?

1 answer

2

Depending on the context in which your table is.

I suggest using Excel tables to facilitate data entry:

inserir a descrição da imagem aqui

If you have doubt how to create on youtube have several tutorials for this or click here

After having your table just use the filter to search by name...

As indicated below:

inserir a descrição da imagem aqui

Now... if you are using macro you can create a macro to help in this research, in a very simple way it would be something like:

Function Pesquisar(ByVal TEXTO_A_SER_PESQUISADO As String)
    ActiveSheet.ListObjects("Tabela1").Range.AutoFilter _
            Field:=1, _
            Criteria1:="=*" & TEXTO_A_SER_PESQUISADO & "*", _
            Operator:=xlAnd
End Function

And using the image example below:

inserir a descrição da imagem aqui

Put this code on Worksheet_change:

Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "$A$1" Then
        Pesquisar (Target.Text)
    End If

End Sub

Here is an example sheet.

Or if using form you can use this macro to fill a combobox with the result of your search.

There is a complete module to work with Excel tables available here.

I hope I’ve helped!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.