• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Extracting email ids

Hi ashish mehra!
I was wondering if you could upload your open book test so the community might help you publishing the open book cheat solutions.
About your question:
a) go to formula bar
b) type (unquoted) "=instr(" and follow the guidelines
c) type "=mid(" and do the same
d) try to build your solution using combinations of b) & c)
Regards!
 
Mr Ashish

Try this!

Code:
=RIGHT(A1,LEN(A1)-FIND("@",A1))

Please provide a sample workbook for quick solution..It may also help some one who is in need the same.
 
May be this!
Code:
Sub Test()
Dim lrow As Long
lrow = Range("A" & Rows.Count).End(xlUp).Row

For i = 1 To lrow ' Change rows starting number
sEmail = Range("A" & i).Value

arTemp = Split(sEmail, "@")

Range("B" & i).Value = arTemp(UBound(arTemp)) 'Change column as required
Next i
End Sub

Let me know any challenges!
 
Hello Ashish.

Basically InStr function finds the position of a specified sub string within the string and returns the first position of its occurrence
 
Did you this VBA code?

May be this!
Code:
Sub Test()
Dim lrow As Long
lrow = Range("A" & Rows.Count).End(xlUp).Row

For i = 1 To lrow ' Change rows starting number
sEmail = Range("A" & i).Value

arTemp = Split(sEmail, "@")

Range("B" & i).Value = arTemp(UBound(arTemp)) 'Change column as required
Next i
End Sub

Let me know any challenges!
 
Split is working superb. Just one line code.
Really interested in knowing the output from INSTR for future reference.

Regards
AM


Something like this...

Code:
Dim s As Byte, str As String

s = InStr(1, stremail, "@") + 1

str = Mid(stremail, s)

s = InStr(1, str, ".") - 1

extractDoamin2 = Left(str, s)
 
Back
Top