validating an e-mail address in excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

what's the formula or reg i should use in excel spreadsheet
to validate a e-mail address of the format (e-mail address removed)
I donno how i shud do ti ..cud someone please help?
Thanx in advance
 
You could validate it to check to see if the string
contains an "@" and contains a "." somewhere after
the "@". Try:

=IF(AND(ISNUMBER(FIND("@",A1)),ISNUMBER(FIND(".",A1,FIND
("@",A1)+1))),"valid e-mail","no")

HTH
Jason
Atlanta, GA
 
Hi
one way: Enter the following code in one of your workbook modules

Public Function MailaddressOK(Adresse As String) As Boolean
Dim oVScriptRegEx As Object
Set oVScriptRegEx = CreateObject("VBScript.RegExp")
With oVScriptRegEx
.Pattern = "^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$"
MailaddressOK = .test(Adresse)
End With
End Function

you may have to register the VBSCRIPT object first in the VBE to use
regular expressions.

in your worksheet you can now enter the formula
=MailaddressOK(A1)
to check A1 for a valid email
 
Back
Top