Академический Документы
Профессиональный Документы
Культура Документы
When you create a formatted Excel table, you can use data validation to prevent duplicates within a colu
NOTE: To prevent duplicates based on entries in multiple columns, see the instructions below
Create a Named Table
Follow these steps, to set up a named table, like the one shown below.
Note: If you aren't using a named table, follow the instructions to Prevent Duplicates in a Range
Type the headings in row 1: EmpID, FName, LName and HireDate
Type 2 rows of sample data
Select a cell in the list, and on the Home tab of the Excel Ribbon, click Format as Table
Click on one of the table styles
Click OK to create the named table
The named table will have four columns, and drop down arrows in the header row.
6. (optional) On the Error Message tab, add a title and error message. For example, Duplicate ID -- "That number has alread
No Spaces in Text
Thanks to Jerry Latham for this example.
Use this custom rule to prevent users from adding ANY spaces in a text string. The SUBSTITUTE functi
The formula in this example checks that the entry in cell B2 is equal to the entry without spaces.
1. Select cell B2
2. On the Ribbon, click the Data tab, then click Data Validation
3. Choose Allow: Custom
4. For the formula, enter:
=B2=SUBSTITUTE(B2," ","")
No Spaces in Cell
You can prevent users from adding ANY spaces in the cell -- whether the entry is text, numbers, or a com
Example 1
Thanks to Jerry Latham for this example.
The LEN function counts the number of characters entered in cell D2, and compares that to the number
1. Select cell D2
2. On the Ribbon, click the Data tab, then click Data Validation
3. Choose Allow: Custom
4. For the formula, enter:
=LEN(D2)=LEN(SUBSTITUTE(D2," ",""))
Example 2
The FIND function looks for the space character - " " - and the ISERROR function result is TRUE, if the
The formula in this example checks that the entry in cell F2 is equal to the entry without spaces.
1. Select cell F2
2. On the Ribbon, click the Data tab, then click Data Validation
3. Choose Allow: Custom
4. For the formula, enter:
=ISERROR(FIND(" ",F2))
Prohibit Weekend Dates
There is a built-in rule setting for Dates, where you can set a date range for the data entry cells. The dates can be typed into
For date rules that do not require a specific date range, create a custom rule. For example, this rule will
The WEEKDAY function returns the weekday number for the date entered. Our formula will use the
based on a named table, the named range will automatically adjust in size, when you add or delete rows.
tries in a specific range on the worksheet. In this example, Employee ID Numbers will be entered in cells B3:B10.
ge $B$3:$B$10, and count how many times the number in cell B3 appears. The formula's result must be 1 or 0:
ays the same, in all of the cells with that custom rule. The cell with the value (B3) is a relative reference -- it shoul
lumns
n this example, three columns will be checked, to make sure that combination has not been entered before. The col
emColour
rom "Ignore Blank Cells", or duplicates will be allowed
tered in row 2. It will be compared to all the combinations that are currently entered. To prevent duplicates, the count must be 1 or 0:
In this example, the total budget cannot go over the amount that is entered in cell B9. The budget amounts are in
sult must be less than or equal to the limit entered in cell B10:
he TRIM function removes spaces before and after the text, and any extra spaces within the text.
med entry in that cell.
The SUBSTITUTE function replaces each space character - " " - with an empty string - ""
without spaces.
s text, numbers, or a combination of both. Here are two formulas that check for spaces.
pares that to the number of characters after SUBSTITUTE removes the space characters.
r delete rows.
entered in cells B3:B10. Use a custom rule to prevent the same number from being entered twice, in those cells.
result must be 1 or 0:
n entered before. The columns are ItemType (A), ItemSize (B), and ItemColour (C). Data validation will be applied
s, the count must be 1 or 0:
e budget amounts are in cells B2:B7, and the formula checks the total in those cells, when you add or edit an entry
ates are entered. You can also use a formula with the built-in date rule, such as =TODAY()-30. That creates a dynamic date range.