Just like any business person, I work with Excel pretty much half of my time when I am not working with SQL Server. Recently I faced challenges when I wanted to extract domain from the email address. I was using excel. I was in extreme rush so I did something which was in fact actually longer route than easier way. I laughed at myself and decided to blog about it.
Here is the way I took to extract domain out of email in excel.
- Imported Excel to SQL Server Table
- Executed script from my blog post to extract domain from email in SQL Server
- Exported SQL Server Table to Excel
In reality, I should just have written a new function in different columns of excel which can extract domain out of Excel.
Here is the function which will extract domain from the email address.
=MID(B2,SEARCH(“@”,B2)+1,255)
Following is the image which displays how above simple excel function can return the domain from the email address.
Reference: Pinal Dave (https://blog.sqlauthority.com)
2 Comments. Leave new
I think you can simply use Text to Column feature of Excel by delimiting ‘@’ of email address.
i think it will be =MID(B2,SEARCH(“@”,B2),1,255) instead of =MID(B2,SEARCH(“@”,B2)+1,255)