You are learning Data Validation in MS Excel
How to set up data validation for email addresses in Excel?
There are two main ways to set up data validation for email addresses in Excel:
Method 1: Using a Custom Formula
1. Select the cells: Choose the cell(s) where you want to restrict data entry to valid email addresses.
2. Data Validation: Go to the "Data" tab and click "Data Validation" in the "Data Tools" group.
3. Allow: Custom: In the "Settings" tab of the Data Validation window, under "Allow," choose "Custom" from the dropdown menu.
4. Formula for Validation: In the "Formula" box, enter the following formula:
```excel
=AND(ISNUMBER(SEARCH("@",A1)), ISNUMBER(SEARCH(".",A1)), NOT(ISNUMBER(SEARCH(" ",A1))))
```
Explanation of the Formula:
- `ISNUMBER(SEARCH("@",A1))`: Checks if "@" symbol exists in the cell (A1 in this example, replace with your cell reference).
- `ISNUMBER(SEARCH(".",A1))`: Checks if a period (".") exists in the cell.
- `NOT(ISNUMBER(SEARCH(" ",A1)))`: Ensures there are no spaces in the email address.
Replace A1 with your actual cell reference if it's different.
5. Error Alert (Optional): In the "Input Message" and "Error Alert" tabs, you can customize messages to be displayed when users enter invalid data or hover over the cell.
6. Click OK: Click "OK" to close the Data Validation window and apply the rule.
Method 2: Using a List of Valid Emails (Less Flexible)
1. Select the cells: Choose the cell(s) where you want to restrict data entry.
2. Data Validation: Go to the "Data" tab and click "Data Validation" in the "Data Tools" group.
3. Allow: List: In the "Settings" tab of the Data Validation window, under "Allow," choose "List" from the dropdown menu.
4. Source: In the "Source" box, type your valid email addresses separated by commas (e.g., "[email address removed], [email address removed]").
5. Error Alert (Optional): Similar to method 1, you can customize message displays.
6. Click OK: Click "OK" to close the Data Validation window and apply the list restriction.
Choosing the Right Method:
- Custom Formula: This method is more flexible as it validates based on email address structure and is not limited to a predefined list.
- List of Valid Emails: This method is simpler to set up but only allows users to choose from the email addresses you provide.