Extract text of the form xxxxxxxxxx@txt.att.net from a column where spacing is all over the place

Willowdale

New Member
i have a column of data where in many cases, there is an sms shortcut of the form xxxxxxxxxx@txt.att.net.
in this column, it might be the only thing , or it might be appended to other text.

I need a formula to : locate all contiguous characters on either side of the @, and extract that value to another column.
the column may look like:

Fred eats apples for breakfast, rev/col 9999999999@tmomail.net Do not reopen.

or

xmannn see 876543 9999999999@txt.att.net

and I would want the blue text copied and posted in, say some adjacent column.

I looked at extraction forumulae, but I couldn't seem to locate this specific case, esp considering the irregularity of the character spacing.

Thanks listers. Greatly appreciate it. My job requires a lot more excel than it used to.

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

mrshl9898

Well-known Member
are there always 9 digits in front of the @ and a .net address?

=LEFT(MID(A1,FIND("@",A1)-10,100),FIND(".net",MID(A1,FIND("@",A1)-10,100))+3)

Rick Rothstein

MrExcel MVP
If there are not always 9 digits (that is it could be any length of text) and if the email address is always surrounded by spaces, then this should work...
Excel Formula:
``=TRIM(RIGHT(SUBSTITUTE(LEFT(A1,FIND("@",A1)-1)," ",REPT(" ",99)),99))&MID(A1,FIND("@",A1),FIND(" ",A1&" ",FIND("@",A1))-FIND("@",A1))``

Saurabhj

Active Member
Hi,

The code is big, and there may be some other formula to extract. But check below:

Excel Formula:
``=MID(B2,FIND("*",SUBSTITUTE(MID(B2,1,FIND("@",B2))," ","*",LEN(MID(B2,1,FIND("@",B2)))-LEN(SUBSTITUTE(MID(B2,1,FIND("@",B2))," ",""))),1)+1,FIND("@",B2)-1-FIND("*",SUBSTITUTE(MID(B2,1,FIND("@",B2))," ","*",LEN(MID(B2,1,FIND("@",B2)))-LEN(SUBSTITUTE(MID(B2,1,FIND("@",B2))," ",""))),1))&MID(B2,FIND("@",B2),IFERROR(FIND(" ",B2,FIND("@",B2)),LEN(B2)+1)-FIND("@",B2))``

Willowdale

New Member

Wow. I never would have got that. Not w my skill level. Thanks fellas, I'll post the solution flag as soon as I can test it.
Seriously, thank you.

Willowdale

New Member
The data I want to extract is in column c, and i have created column d as the target column. Will that affect the above?

Rick Rothstein

MrExcel MVP
For the formula I posted in Message #3...
Excel Formula:
``=TRIM(RIGHT(SUBSTITUTE(LEFT(C1,FIND("@",C1)-1)," ",REPT(" ",99)),99))&MID(C1,FIND("@",C1),FIND(" ",C1&" ",FIND("@",C1))-FIND("@",C1))``

Willowdale

New Member
Rick, thanks very much sir. Worked like a charm. I don't know how you guys keep all that formula syntax straight in your head.
And sorry, I should have been able to hash that much out.

Replies
0
Views
87
Replies
0
Views
348
Replies
5
Views
656

1,130,193
Messages
5,640,771
Members
417,166
Latest member
Funwayo

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.

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

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