#1   Report Post  
Posted to microsoft.public.excel.misc
GoBobbyGo
 
Posts: n/a
Default email validation?

is there a built-in function in Excel that tells whether a text string is a
valid email? (I don't mean whether the address exists or not, but rather if
it has exactly one "@" in it, then some letters, then a ".", some more
letters, etc)

I can build one, but before I do...

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc
  #2   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default email validation?

There is no built-in way to do this. Try

Dim S As String
S = "
If S Like "?*@?*.?*" Then
Debug.Print "OK"
Else
Debug.Print "Not ok"
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"GoBobbyGo" wrote in
message
...
is there a built-in function in Excel that tells whether a text
string is a
valid email? (I don't mean whether the address exists or not,
but rather if
it has exactly one "@" in it, then some letters, then a ".",
some more
letters, etc)

I can build one, but before I do...

----------------
This post is a suggestion for Microsoft, and Microsoft responds
to the
suggestions with the most votes. To vote for this suggestion,
click the "I
Agree" button in the message pane. If you do not see the
button, follow this
link to open the suggestion in the Microsoft Web-based
Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc



  #3   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default email validation?

This one is better than my previous reply:

If Len(S) - Len(Replace(S, "@", "")) = 1 Then
If S Like "?*@?*.?*" Then
Debug.Print "OK"
Else
Debug.Print "Not ok"
End If
Else
Debug.Print "not ok"
End If


"Chip Pearson" wrote in message
...
There is no built-in way to do this. Try

Dim S As String
S = "
If S Like "?*@?*.?*" Then
Debug.Print "OK"
Else
Debug.Print "Not ok"
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"GoBobbyGo" wrote in
message
...
is there a built-in function in Excel that tells whether a
text string is a
valid email? (I don't mean whether the address exists or not,
but rather if
it has exactly one "@" in it, then some letters, then a ".",
some more
letters, etc)

I can build one, but before I do...

----------------
This post is a suggestion for Microsoft, and Microsoft
responds to the
suggestions with the most votes. To vote for this suggestion,
click the "I
Agree" button in the message pane. If you do not see the
button, follow this
link to open the suggestion in the Microsoft Web-based
Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc





  #4   Report Post  
Posted to microsoft.public.excel.misc
GoBobbyGo
 
Posts: n/a
Default email validation?

I ended up just going with the function:

=IF(OR(ISERROR(FIND("@",M14)),ISERROR(FIND(".",RIG HT(M14,LEN(M14)-FIND("@",M14))))),"invalid",IF(AND(FIND("@",M14)1 ,ISERROR(FIND("@",RIGHT(M14,LEN(M14)-FIND("@",M14)))),FIND(".",RIGHT(M14,LEN(M14)-FIND("@",M14)))1,FIND(".",RIGHT(M14,LEN(M14)-FIND("@",M14)))<LEN(M14)-FIND("@",M14)),"valid","invalid"))
"Chip Pearson" wrote:

This one is better than my previous reply:

If Len(S) - Len(Replace(S, "@", "")) = 1 Then
If S Like "?*@?*.?*" Then
Debug.Print "OK"
Else
Debug.Print "Not ok"
End If
Else
Debug.Print "not ok"
End If


"Chip Pearson" wrote in message
...
There is no built-in way to do this. Try

Dim S As String
S = "
If S Like "?*@?*.?*" Then
Debug.Print "OK"
Else
Debug.Print "Not ok"
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"GoBobbyGo" wrote in
message
...
is there a built-in function in Excel that tells whether a
text string is a
valid email? (I don't mean whether the address exists or not,
but rather if
it has exactly one "@" in it, then some letters, then a ".",
some more
letters, etc)

I can build one, but before I do...

----------------
This post is a suggestion for Microsoft, and Microsoft
responds to the
suggestions with the most votes. To vote for this suggestion,
click the "I
Agree" button in the message pane. If you do not see the
button, follow this
link to open the suggestion in the Microsoft Web-based
Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc






  #5   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default email validation?

I use this UDF


'-----------------------------------------------------------------
Public Function ValidEmail(Adress As String) As Boolean
'-----------------------------------------------------------------
Dim oRegEx As Object
Set oRegEx = CreateObject("VBScript.RegExp")
With oRegEx
.Pattern = "^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$"
' .Pattern = "^(\w+\.)*(\w+)@(\w+\.)+([a-zA-Z]{2,4})$"
ValidEmail = .Test(Adress)
End With
Set oRegEx = Nothing
End Function


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"GoBobbyGo" wrote in message
...
I ended up just going with the function:


=IF(OR(ISERROR(FIND("@",M14)),ISERROR(FIND(".",RIG HT(M14,LEN(M14)-FIND("@",M
14))))),"invalid",IF(AND(FIND("@",M14)1,ISERROR(F IND("@",RIGHT(M14,LEN(M14)
-FIND("@",M14)))),FIND(".",RIGHT(M14,LEN(M14)-FIND("@",M14)))1,FIND(".",RIG
HT(M14,LEN(M14)-FIND("@",M14)))<LEN(M14)-FIND("@",M14)),"valid","invalid"))
"Chip Pearson" wrote:

This one is better than my previous reply:

If Len(S) - Len(Replace(S, "@", "")) = 1 Then
If S Like "?*@?*.?*" Then
Debug.Print "OK"
Else
Debug.Print "Not ok"
End If
Else
Debug.Print "not ok"
End If


"Chip Pearson" wrote in message
...
There is no built-in way to do this. Try

Dim S As String
S = "
If S Like "?*@?*.?*" Then
Debug.Print "OK"
Else
Debug.Print "Not ok"
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"GoBobbyGo" wrote in
message
...
is there a built-in function in Excel that tells whether a
text string is a
valid email? (I don't mean whether the address exists or not,
but rather if
it has exactly one "@" in it, then some letters, then a ".",
some more
letters, etc)

I can build one, but before I do...

----------------
This post is a suggestion for Microsoft, and Microsoft
responds to the
suggestions with the most votes. To vote for this suggestion,
click the "I
Agree" button in the message pane. If you do not see the
button, follow this
link to open the suggestion in the Microsoft Web-based
Newsreader and then
click "I Agree" in the message pane.


http://www.microsoft.com/office/comm...lic.excel.misc







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sending email from excel not working Tripp Excel Discussion (Misc queries) 2 February 1st 06 08:42 PM
Remove Duplication from Validation List? [email protected] Excel Discussion (Misc queries) 1 January 17th 06 02:27 AM
Copy workbook- Validation function sjs Excel Worksheet Functions 3 December 28th 05 03:00 PM
Move a Column of 500 Email Addresses into BCC Field of an Email Mark Excel Worksheet Functions 9 July 27th 05 05:07 AM
body of email disappears when I send an email from Excel ~A Excel Discussion (Misc queries) 0 February 25th 05 10:55 PM


All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"