Excel advanced help needed
Author
Discussion

topless_mx5

Original Poster:

2,763 posts

248 months

Thursday 8th April 2010
quotequote all
I have a long list of email addresses in Excel. I wish to replace the beginning part of all the addresses with a certain string, i.e. I want to replace the text up to the @ part of the addresses.

How can I do this in Excel? I am assuming I will need to use the replace function using VB but I've never been too good with it myself.

Liszt

4,337 posts

300 months

Thursday 8th April 2010
quotequote all
What do you want to replace it with?

Aviz

1,669 posts

199 months

Thursday 8th April 2010
quotequote all
A quick and dirty way is to copy the list into notepad, save as txt.

Import back into excel, using @ as the delimiter. ?

Jinx

12,022 posts

290 months

Thursday 8th April 2010
quotequote all
Aviz said:
A quick and dirty way is to copy the list into notepad, save as txt.

Import back into excel, using @ as the delimiter. ?
You could always use the "text to columns" function to do this.

Liszt

4,337 posts

300 months

Thursday 8th April 2010
quotequote all
Col A Col B Gives
Somebody@company.com =MID(A3,1,(FIND("@",A3))-1) Somebody
Somebody@company.com =MID(A4,(FIND("@",A4))+1,1000) company.com
Somebody@company.com =MID(A5,(FIND("@",A5)),1000) @company.com


bitwrx

1,352 posts

234 months

Thursday 8th April 2010
quotequote all
It looks like FIND, and LEFT (and/or RIGHT) will sort you out.

Get the position of the @ symbol (assuming there's only one), then get concatenate your string and the RIGHTmost part of the email address.

You may need to use the LEN function as well.

These are all worksheet functions. No need for VBA.

Having just typed all that, it turns out there is a REPLACE function that may do what you want.

As always Excel is all about knowing the cookbook inside out.

Gah. Too slow. (And less helpful)

Edited by bitwrx on Thursday 8th April 11:21

Aviz

1,669 posts

199 months

Thursday 8th April 2010
quotequote all
Jinx said:
Aviz said:
A quick and dirty way is to copy the list into notepad, save as txt.

Import back into excel, using @ as the delimiter. ?
You could always use the "text to columns" function to do this.
Yup.. having looked at this, it's negates the need to export tot txt. Far easier.

I'm definitely not an excel expert, but i have done exactly what the OP is asking for before using my dirty, inneficient way smile


Aviz

1,669 posts

199 months

Thursday 8th April 2010
quotequote all
Liszt said:
Col A|| Col B|| Gives||
Somebody@company.com =MID(A3,1,(FIND("@",A3))-1) Somebody
Somebody@company.com =MID(A4,(FIND("@",A4))+1,1000) company.com
Somebody@company.com =MID(A5,(FIND("@",A5)),1000) @company.com
This gets my vote !

topless_mx5

Original Poster:

2,763 posts

248 months

Thursday 8th April 2010
quotequote all
Liszt said:
Col A|| Col B|| Gives||
Somebody@company.com =MID(A3,1,(FIND("@",A3))-1) Somebody
Somebody@company.com =MID(A4,(FIND("@",A4))+1,1000) company.com
Somebody@company.com =MID(A5,(FIND("@",A5)),1000) @company.com
Excellent!

I've now got a list of all the emails with the second half of the address, i.e. @company.com

How do I add something to the beginning of all of them, i.e. info?

Liszt

4,337 posts

300 months

Thursday 8th April 2010
quotequote all
=CONCATENATE("Info",MID(A5,(FIND("@",A5)),1000))


Hmm. Your not setting up a spam list are you? Feels like I have just handed over a loaded gun

ewenm

28,506 posts

275 months

Thursday 8th April 2010
quotequote all
Liszt said:
=CONCATENATE("Info",MID(A5,(FIND("@",A5)),1000))


Hmm. Your not setting up a spam list are you? Feels like I have just handed over a loaded gun
Or ="Info"&MID(A5,(FIND("@",A5)),1000)

topless_mx5

Original Poster:

2,763 posts

248 months

Thursday 8th April 2010
quotequote all
Liszt said:
=CONCATENATE("Info",MID(A5,(FIND("@",A5)),1000))
Thank you!

Liszt said:
Hmm. Your not setting up a spam list are you? Feels like I have just handed over a loaded gun
Its an old subscribed list we had lying around, but it seems as though many of the name specific emails are no longer in use. Certainly not spam though.