Usando macros / VBA:
Public Function extract_name(transaction As String)
Dim WordArray() As String
WordArray() = Split(transaction, " ")
firstName = WordArray(5)
extract_name = firstName
extract_name_uc = UCase(extract_name)
If extract_name = extract_name_uc Then
topBound = 5
Else
topBound = 6
End If
extract_name = ""
For i = topBound To UBound(WordArray)
tempValue = WordArray(i)
If IsNumeric(tempValue) Then
i = UBound(WordArray)
Else
extract_name = extract_name & " " & tempValue
End If
Next i
extract_name = Trim(extract_name)
End Function
Public Function extract_amount(transaction As String)
Dim WordArray() As String
WordArray() = Split(transaction, " ")
extract_amount = WordArray(UBound(WordArray) - 1)
End Function
Existem duas funções extract_name
e extract_amount
.
Abra o VBA com ALT + F11, insira um módulo em ThisWorkbook e cole o código no lado direito.
Supondo que TRSF E-BANKING DB 2701/FTSCY/WS95051 12000.00 JAMES BOND 12,000.00 DB
esteja na célula A2 , então:
B2 =extract_name(A2)
e C2 =extract_amount(A2)
.