What excel function should I use?

2

I have a list of male and female names that I need to determine in the front cell of the gender of the name.

The logic that analyzes the name and says if it is male and female is ready, however, I need to create the following logic, but I do not know which Excel function I can use.

In field H4 (number 4), I need to write the function that will take the text from field G4 (number 1), use this text in field C6 (number 2) where the logic that determines the gender is found, and pick up the result of field C12 (number 3) to return the result in field H4 (number 4).

I need to apply this logic to all names listed in column G. How should I proceed?

    
asked by anonymous 24.07.2017 / 16:53

1 answer

2

One way to solve this would be the following code (vba) in your spreadsheet ( Worksheet_Change ):

Private Sub Worksheet_Change(ByVal Target As Range)

Dim celNome As String ' Célula onde deseja verificar o nome
Dim celGenero As String ' Célula que retorna o gênero
Dim colEntrada As Integer ' Coluna onde dará entrada de dados (nomes)

    celNome = "C6"
    celGenero = "C12"
    colEntrada = 7 ' 7=coluna "G"

    ' Verifica se está na coluna de entrada de dados        
    If Target.Column = colEntrada Then
        ' Copia o nome inserido na célula de análise
        Range(celNome).Value = Target.Value
        ' Retorna o gênero após análise
        Target.Offset(0, 1).Value = Range(celGenero).Value
    End If

End Sub
    
24.07.2017 / 19:44