Excel Function

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Are there any characters between the email addresses? If you don't have spaces or something else then this is a problem - you'll need an exhaustive list of endings and you'll need to use a macro.

WBD
 
Upvote 0
Here's what I tried:

Code:
Public Sub SplitEmailAddresses()

Dim endings As Variant
Dim allEmails As String
Dim separateMails As Variant
Dim index As Long

' Change to list all possible endings
endings = Array(".com", ".co.uk", ".se", ".no")

' Retrieve the concatenated emails
allEmails = Range("A1").Value

' Process each ending
For index = 0 To UBound(endings)
    allEmails = Replace(allEmails, endings(index), endings(index) & "|", 1, -1, vbTextCompare)
Next index

' Split out the results
If Right$(allEmails, 1) <> "|" Then allEmails = allEmails & "|"
separateMails = Split(allEmails, "|")

' Populate the answers
For index = 0 To UBound(separateMails) - 1
    Cells(1, index + 2).Value = separateMails(index)
Next

End Sub

Here's the result:


Book1
ABCDE
1a@b.comd@abc.co.ukmonkeys@apes.seoslo@norway.noa@b.comd@abc.co.ukmonkeys@apes.seoslo@norway.no
Sheet1


WBD
 
Upvote 0

Forum statistics

Threads
1,215,507
Messages
6,125,201
Members
449,214
Latest member
mr_ordinaryboy

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