18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Part IV<br />

Using Advanced Excel Features<br />

FIGURE 25.6<br />

Using data validation to prevent duplicate entries in a range.<br />

Accepting text that begins with A<br />

The following Data Validation formula demonstrates how to check for a specific character. In this case,<br />

the formula ensures that the user’s entry is a text string that begins with the letter A (either uppercase or<br />

lowercase).<br />

=LEFT(A1)=”a”<br />

This formula assumes that the active cell in the selected range is cell A1.<br />

The following formula is a variation of this validation formula. In this case, the formula ensures that the<br />

entry begins with the letter A and contains exactly five characters.<br />

=COUNTIF(A1,”A????”)=1<br />

Accepting only a date that’s a Monday<br />

The following Data Validation formula ensures that the cell entry is a date, and the date is a Monday.<br />

=WEEKDAY(A1)=2<br />

This formula assumes that the active cell in the selected range is cell A1. It uses the WEEKDAY function,<br />

which returns 1 for Sunday, 2 for Monday, and so on.<br />

Accepting only values that don’t exceed a total<br />

Figure 25.7 shows a simple budget worksheet, with the budget item amounts in the range B1:B6. The total<br />

budget is in cell E5, and the user is attempting to enter a value in cell B4 that would cause the total to<br />

exceed the budget. The following Data Validation formula ensures that the sum of the budget items does<br />

not exceed the budget:<br />

=SUM($B$1:$B$6)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!