Get Substring from a cell with variable length string

azamo

New Member
Joined
Oct 19, 2017
Messages
3
Hello Excelperts,

I find myself in a bit of a conundrum and looking for your help and expertise to learn how to pull a substring from a cell of variable length string.

From the transcript column A1, I have variable length transcript string, what I am looking to extract is the name of the person who is chatting with (highlighted in Red below). The text highlighted in GREEN is always consistent, so I need to pull the substring after the "You are now chatting with " and before the Period at the end of that line.

How would I go about doing this? Any help would be greatly appreciated!!

TranscriptName
14:09:54 info: Thank you for choosing to chat with us. An agent will be with you shortly.


14:09:56 info:


14:09:56 info:


14:09:56 info: You are now chatting with Jose C.


14:10:10 Jose: <span>Hi, I'm Jose C, I am glad to help you.
Jose C

<tbody>
</tbody>
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
How's this? I am assuming there is always a full stop after the name in this.

=MID(INDEX(A:A,MATCH("*You are now chatting with*",A:A,0),1),FIND("You are now chatting with",INDEX(A:A,MATCH("*You are now chatting with*",A:A,0),1))+25,LEN(INDEX(A:A,MATCH("*You are now chatting with*",A:A,0),1))-FIND("You are now chatting with",INDEX(A:A,MATCH("*You are now chatting with*",A:A,0),1))-25)
 
Last edited:
Upvote 0
Another way - Assuming the string to be returned doesn't exceed 50 characters :

=IFERROR(SUBSTITUTE(MID(A2,FIND("You are now chatting with",A2)+26,50),".",""),"")

Enter in B2 and fill down
 
Last edited:
Upvote 0
Another way - Assuming the string to be returned doesn't exceed 50 characters :

=IFERROR(SUBSTITUTE(MID(A2,FIND("You are now chatting with",A2)+26,50),".",""),"")

Enter in B2 and fill down

Thank you so much!!! you are amazing, this worked just like I expected.
 
Upvote 0
Actually, it did not work as expected, I did not expand the row, my apologies!! there is still text after "Jose C.", How do I delete everything after the name?
 
Upvote 0
Do they always have just a single initial Surname?

=IFERROR(LEFT(SUBSTITUTE(MID(A2,FIND("You are now chatting with",A2)+26,50),".",""),FIND(" ",SUBSTITUTE(MID(A2,FIND("You are now chatting with",A2)+26,50),".",""))+1),"")

Or if there's always a full stop after the name

=IFERROR(LEFT(MID(A2,FIND("You are now chatting with",A2)+26,50),FIND(".",MID(A2,FIND("You are now chatting with",A2)+26,50))-1),"")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,600
Members
449,038
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top