Extract last word from a cell that includes the '@' character.

toddy00

New Member
Joined
Feb 17, 2015
Messages
2
Hi guys.

I found some brilliant advice on extracting the last cell from a cell of data in this thread from 2012. The user Rober Mika provided this formula for extraction of the last word from a cell:

=UPPER(TRIM(RIGHT(SUBSTITUTE(TRIM(X1)," ",REPT(" ",99)),99)))

This works great for most circumstances, however I have rows of data in which I am trying to extract twitter handles, meaning the last word begins with the @ symbol, 2 example rows of data below for reference:

Architectural DigestVerified account @ArchDigest
Architecture for...Verified account @archforhumanity

When I apply the formula above to this data, it extracts the last two words (instead of only the last word only) so the results look like this:

ACCOUNT @ARCHDIGEST
ACCOUNT @ARCHFORHUMANITY

Is there any amendment I can make to the formula that would extract only the last word (which will always begin with @ for my purposes of extracting the twitter handle from the data)?

Many thanks for your time and any assistance you can offer!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi.

If there's only ever one occurrence of a "@" within the string:

=MID(A1,FIND("@",A1)+1,LEN(A1))

If there may be several occurrences of a "@" within the string, but the desired extraction will always immediately follow the last such occurrence:

=TRIM(RIGHT(SUBSTITUTE(A1,"@",REPT(" ",LEN(A1))),LEN(A1)))

Regards
 
Upvote 0

Forum statistics

Threads
1,215,220
Messages
6,123,693
Members
449,117
Latest member
Aaagu

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