Link to home
Start Free TrialLog in
Avatar of ivan rosa
ivan rosaFlag for United States of America

asked on

Extract Text from a cell

Hello Folks,

I'm trying to extract the word that starts with " CHARS " from the string below within a cell, can anybody kindly provide any ideas on how to?
ABCDEFGH MMM Upgrade Patch (MMM111x) - Win 7,ABC006A8,TXT_CCC_Install_Collection_jazzmen,Required,CCC ABCDEFGH CCC Upgrade Patch (QWERTYU),Deployment failed,No additional information,0x87D00213 (-2016411117),Timeout occurred,CHARS10133X166,19,4/12/2019 7:03 PM,Error,Script,No,(SYSTEM),No,No,Yes,

Open in new window

Avatar of John
John
Flag of Canada image

To extract a string in a random spot in an Excel cell, I think you might need an add-in like Kutools

https://www.extendoffice.com/documents/excel/3639-excel-extract-part-of-string.html
Avatar of Ejgil Hedegaard
With the text in A1 you can use
=IFERROR(MID(A1,FIND("CHARS",A1),FIND(",",A1,FIND("CHARS",A1))-FIND("CHARS",A1)),"")

Open in new window


It extract the value CHARS10133X166
Avatar of ivan rosa

ASKER

Hi John, thanks for your quick support. the above plugin required a license...

Hi Ejgil, Thanks for your technically although when I run the formula it only leaves the cell blank...
Try the trial version and if it does what you want , then you can license it
You can use this user defined function.

Function FindString(r As Range) As String
Dim strParts() As String
Dim IntEntry As Integer

strParts = Split(r, ",")
For IntEntry = 0 To UBound(strParts)
    If strParts(IntEntry) Like "*CHARS*" Then
        FindString = strParts(IntEntry)
        Exit For
    End If
Next
    
End Function

Open in new window

Usage:
=FindString("A1")
ASKER CERTIFIED SOLUTION
Avatar of Ejgil Hedegaard
Ejgil Hedegaard
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A one-liner of VBA will do:

Public Function GetCode(FullCode) As String
    FindCode = Split(Split(FullCode, "CHARS")(1), ",")(0)
End Function

Open in new window

Thanks everyone involved ! I'd really appreciated