How do I isolate all company addresses ?

Maverick27

Active Member
Joined
Sep 23, 2010
Messages
329
Office Version
  1. 2013
Platform
  1. Windows
Attn all Excel Gurus

I have an Excel sheet of 500K Email Addresses.

How do isolate all company addressess eg addresses which DON'T have the following domains ?

@Yahoo ;
@gmail ;
@Hotmail ;
@Live ;
@ymail ;
@msn

Anyone care to share a Excel function or Macro to filter out the company address domains.

Below is a screenshot of the Excel list.

Thanks in Advance.

excel.jpg
 
Was the sheet with the emails the active sheet when you ran the code?
Also do you have any data that does not have an @ in it?
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You could also delete them

VBA Code:
Sub jec()
 With Range("A2", Range("A" & Rows.Count).End(xlUp))
   .Replace "*@live.*", "", xlPart
   .Replace "*@Yahoo.*", "", xlPart
   .Replace "*@Hotmail.*", "", xlPart
   .Replace "*@ymail.*", "", xlPart
   .Replace "*@msn.*", "", xlPart
   .Replace "*@Gmail.*", "", xlPart
   On Error Resume Next
   .SpecialCells(4).EntireRow.Delete
 End With
End Sub
 
Upvote 0
And one non looping method with Regex

VBA Code:
Sub jec()
 Dim ar, sp
 Set ar = Range("A1", Range("A" & Rows.Count).End(xlUp))
 
 With CreateObject("VBScript.RegExp")
    .Global = True
    .Pattern = "(@yahoo|@gmail|@hotmail|@live|@ymail|@msn)(\.)"
    ar.AutoFilter 1, Filter(Split(.Replace(Join(Application.Transpose(ar)), "")), "@", 1), 7
 End With
End Sub
 
Upvote 0
Not in my version...weird. I tried with 500k rows. Did you try?
 
Upvote 0
And one non looping method with Regex

VBA Code:
Sub jec()
 Dim ar, sp
 Set ar = Range("A1", Range("A" & Rows.Count).End(xlUp))
 
 With CreateObject("VBScript.RegExp")
    .Global = True
    .Pattern = "(@yahoo|@gmail|@hotmail|@live|@ymail|@msn)(\.)"
    ar.AutoFilter 1, Filter(Split(.Replace(Join(Application.Transpose(ar)), "")), "@", 1), 7
 End With
End Sub

Is this code an improvement from previous one ?

I don't see any difference in the output ?
 
Upvote 0
Not in my version...weird. I tried with 500k rows. Did you try?

I've run some tests on 300k rows of data & it definitely doesn't work, I only end up with about 34k rows visible when there should be a lot more.
 
Upvote 0
But you didn't get an error?

I don't see any difference in the output ?
This method is not based on partial matches. With the filter(filter(filter method, it also finds "@live.uk.nl" because the word "@Live" is found
 
Upvote 0
@Maverick27 You should consider using the replace/delete method.. that will definitely work.
 
Upvote 0
Excel 365 abonnement
 

Attachments

  • Schermafbeelding 2022-01-17 151317.png
    Schermafbeelding 2022-01-17 151317.png
    20.5 KB · Views: 9
  • Schermafbeelding 2022-01-17 151708.png
    Schermafbeelding 2022-01-17 151708.png
    4.6 KB · Views: 8
Upvote 0

Forum statistics

Threads
1,215,470
Messages
6,124,990
Members
449,201
Latest member
Lunzwe73

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