Removing specific emails from a list of emails

Jambo_

New Member
Joined
Dec 6, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi,

I recently had to export a list of emails to excel and want to refine the list but am not sure on how to.

The exported list shows who the email is from and the address it was sent to. In this example I will be hotmail.

Hotmail have been contacting apple over x number of years but hotmail have been cc'd into each email. This fills the To column with hotmail address that I don't want there. How do I delete the hotmail address and leave the apple and gmail account there?

The cell is split by ( ; space ). All the emails are within column B and multiple emails are in each cell.

1670325399460.png
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi & welcome to MrExcel.
How about
Excel Formula:
=LET(a,TEXTSPLIT(B2,"; "),TEXTJOIN("; ",,FILTER(a,ISERROR(SEARCH("hotmail",a)))))
 
Upvote 0
Power Query solution: Split column by delimiter (Custom: "; ") into rows, then filter by Does Not Contain "@Hotmail".

Book1
AB
1FromTo
25@hotmail.com1@hotmail.com; 2@hotmail.com; 3@gmail.com; 4@apple.com
3
4FromTo
55@hotmail.com3@gmail.com
65@hotmail.com4@apple.com
Sheet1


1670326178216.png


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"From", type text}, {"To", type text}}),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"To", Splitter.SplitTextByDelimiter("; ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "To"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"To", type text}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type1", each not Text.Contains([To], "@hotmail"))
in
    #"Filtered Rows"
 
Upvote 0
Solution
Power Query solution: Split column by delimiter (Custom: "; ") into rows, then filter by Does Not Contain "@Hotmail".

Book1
AB
1FromTo
25@hotmail.com1@hotmail.com; 2@hotmail.com; 3@gmail.com; 4@apple.com
3
4FromTo
55@hotmail.com3@gmail.com
65@hotmail.com4@apple.com
Sheet1


View attachment 80279

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"From", type text}, {"To", type text}}),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"To", Splitter.SplitTextByDelimiter("; ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "To"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"To", type text}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type1", each not Text.Contains([To], "@hotmail"))
in
    #"Filtered Rows"

Thank you! That's it working now
 
Upvote 0
Did you try the formula I suggested?
 
Upvote 0

Forum statistics

Threads
1,215,011
Messages
6,122,677
Members
449,092
Latest member
tayo4dgacorbanget

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