How to obtain a multiple option text result

Matute

New Member
Joined
Sep 24, 2015
Messages
13
Hi all,

I need 1 formula to obtain a multiple text option result. As result i need to obtain the words "REINTEGRO" OR "HONORARIOS".
In 1 cell i will have the text "REINTEGRO ALUMNO GIOVANNI JUAN CASTRO" and in a different cell i will have a text as "HONORARIOS POR DICTADO DE CLASE" in the other cells the text will be different. But i need to quickly identfy those where "REINTEGRO" OR "HONORARIOS" are.


DETAILRESULT
FONDO TESORERIA REPOSICION
HONORARIOS POR DICTADO DE EXAMENHONORARIOS
REINTEGRO ALUMNOS GIOVANINI JUAN AGUSTOREINTEGRO

Thank you!!!!
 

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
5,037
Office Version
2019
Platform
Windows
A vba solution

VBA Code:
Option Explicit

Sub Matute()
    Dim i As Long, lr As Long
    lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To lr
        If InStr(Range("A" & i), "HONORARIOS") > 0 Then
            Range("B" & i) = "HONORARIOS"
        ElseIf InStr(Range("A" & i), "REINTEGRO") > 0 Then
            Range("B" & i) = "REINTEGRO"
        End If
    Next i
End Sub
 

sandy666

Well-known Member
Joined
Oct 24, 2015
Messages
3,259
you can try Power Query aka Get&Transform

Code:
// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    Result = Table.AddColumn(Source, "Result", each if Text.Contains([DETAIL], "REINTEGRO") then "REINTEGRO" else if Text.Contains([DETAIL], "HONORARIOS") then "HONORARIOS" else null)
in
    Result
note: Power Query is case sensitive, so REINTEGRO <> Reintegro and so on....
 
Last edited:

Forum statistics

Threads
1,078,006
Messages
5,337,692
Members
399,162
Latest member
Sabina

Some videos you may like

This Week's Hot Topics

Top