Confirm Email Address Formats Using Data Validation
This first method uses data validation to look for the @ symbol in your selected cells. If the symbol isn’t found, you can display an error indicator on the cell or reject the data.
Select the cells where you want to apply the data validation. Then, click Data > Data Validation from the menu.
Confirm the selection in the Cell Range box. For the Criteria, choose “Text” in the first drop-down box, “Contains” in the second, and then enter the @ symbol in the box on the right.
Next to “On Invalid Data,” decide if you want to show a warning or reject the input.
If you choose Show Warning, you’ll see an error indicator (red triangle) on the top right corner of the cell. Hover your cursor over it to see the warning message.
If you choose Reject Input, you must include the @ symbol when typing in the cell. If you do not, then your text will be rejected. For this option, we recommend that you include help text. This can eliminate confusion to the user as to why their data violates the cell’s rule and isn’t being accepted.
Check the box next to Appearance for “Show Validation Help Text.” You can then use the default message or type in a custom message.
Then, when invalid data is entered, you’ll see a pop-up message with that help text.
Click “Save” when you finish setting up the data validation.
Confirm Email Address Formats Using a Function
While checking for the @ symbol to validate the format of an email address is good, you may need to go a step further. For instance, you may have the @ symbol but no extension such as Myemail@gmail
. As you can see, the .com
is missing.
By using the ISEMAIL function, you can check for both the symbol and the extension. The function will return a simple true or false response.
Select a cell where you want to enter the formula and display the response. Type the following replacing the B2 cell reference with your own:
=ISEMAIL(B2)
Press Enter or Return and you should then see TRUE for a valid email address and FALSE for an invalid one.
The function checks for the following extensions:
- .com
- .net
- .org
- .edu
- .gov
- .info
If you have an entire column of email addresses that you want to check, as in our example, you can use the fill handle to copy the function to the remaining cells.
Then, you’ll see TRUE
or FALSE
for all emails in that column of your sheet. As examples, we’ve highlighted an email address without the symbol or extension, with only the symbol, with only the extension, and one with both making it a valid format. You can see in the screenshot below, the first three are invalid (False) and the fourth is valid (True).
No comments:
Post a Comment