Jonathan đã phát triển một bảng tính theo dõi ngày đến hạn cho các tài liệu của bộ phận khác nhau. Anh tự hỏi liệu có cách nào để Excel thông báo cho anh biết ngày đến hạn cho một tài liệu cụ thể đang đến gần hay không.

Có một số cách có thể được thực hiện trong Excel và bạn nên chọn phương pháp phù hợp nhất với mục đích của mình. Phương pháp đầu tiên là chỉ cần thêm một cột vào trang tính của bạn sẽ được sử dụng cho cảnh báo.

Giả sử ngày đến hạn của bạn nằm trong cột F, bạn có thể đặt loại công thức sau vào cột G:

=IF(F3<(TODAY()+7),"

The formula checks to see if the date in cell F3 is earlier than a week from today. If so, then the formula displays "< Another approach is to use the conditional formatting capabilities of Excel. Follow these steps:



Select the cells that contain the document due dates.

Choose Conditional Formatting from the Format menu. Excel displays the Conditional Formatting dialog box.

Make sure the first drop-down list is "Cell Value Is." (This should be the default.) (See Figure 1.)   Figure 1. The Conditional Formatting dialog box.



Make sure the second drop-down list is "Less Than."

In the formula area, enter "=TODAY()" (without the quote marks).

Click the Format button. Excel displays the Format Cells dialog box. (See Figure 2.)   Figure 2. The Format Cells dialog box.



Using the Color drop-down list, choose the color red.

Click OK to close the Format Cells dialog box.

Click Add. The Conditional Format dialog box expands to include a second condition.

Make sure the first drop-down list for the second condition is "Cell Value Is." (This should be the default.)

Make sure the second drop-down list is "Less Than."

In the formula area, enter "=TODAY()+7" (without the quote marks).

Click the Format button. Excel displays the Format Cells dialog box.

Using the Color drop-down list, choose the color blue.

Click OK to close the Format Cells dialog box. (See Figure 3.)   Figure 3. The finished Conditional Formatting dialog box.



Click OK to close the Conditional Formatting dialog box.



This is a two-tiered format, and you end up with two levels of alert. If the due date is already past, then it shows up as red. If the due date is today or within the next seven days, then it shows up in blue.

ExcelTips là nguồn của bạn để đào tạo Microsoft Excel hiệu quả về chi phí.

Mẹo này (3179) áp dụng cho Microsoft Excel 97, 2000, 2002 và 2003. Bạn có thể tìm phiên bản của mẹo này cho giao diện ribbon của Excel (Excel 2007 trở lên) tại đây: