11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Chapter 19: Conditional Formatting and Data Validation 543<br />

Figure 19-23: Using a custom VBA function to apply conditional formatting to cells that contain a formula.<br />

The following conditional formatting formula applies formatting to cell A1 if it contains a date and<br />

the month is June:<br />

=AND(CELLHASDATE(A1),MONTH(A1)=6)<br />

The following conditional formatting formula applies formatting to cell A1 if it contains a date and<br />

the date falls on a weekend:<br />

=AND(CELLHASDATE(A1),OR(WEEKDAY(A1)=7,WEEKDAY(A1)=1))<br />

Identifying invalid data<br />

You might have a situation in which the data entered must adhere to some very specific rules,<br />

and you’d like to apply special formatting if the data entered is not valid. For example, consider<br />

part numbers that consist of seven characters: four uppercase alphabetic characters, followed by<br />

a hyphen, and then a two-digit number — for example, ADSS-09 or DYUU-43.<br />

You can write a conditional formatting formula to determine whether part numbers adhere to<br />

this structure, but the formula is very complex. The following formula, for example, returns TRUE<br />

only if the value in A1 meets the part number rules specified:

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

Saved successfully!

Ooh no, something went wrong!