Wordle: 1

Sunday 4 January 2015

Using conditional formatting to highlight dates in Excel

Using conditional formatting to highlight dates in Excel....

Date functions in Excel make it is possible to perform date calculations, like addition or subtraction, resulting in automated or semi-automated worksheets. The NOW function, which calculates values based on the current date and time, is a great example of this.
Taking this functionality a step further, when you mix date functions with conditional formatting, you can create spreadsheets that display date alerts automatically when a deadline is near or differentiates between types of days, like weekends and weekdays.
The basics of conditional formatting for dates
To find conditional formatting for dates, go to

Home > Conditional Formatting > Highlight Cell Rules > A Date Occuring.

You can select the following date options, ranging from yesterday to next month:


These 10 date options generate rules based on the current date. If you need to create rules for other dates (e.g., greater than a month from the current date), you can create your own new rule.
Below are step-by-step instructions for a few of my favorite conditional formats for dates.
Highlighting weekends

When you design an automated calendar you don’t need to color the weekends yourself. With the conditional formatting tool, you can automatically change the colors of weekends by basing the format on the WEEKDAY function.  Assume that you have the date table–a calendar without conditional formatting:


To change the color of the weekends, open the menu Conditional Formatting > New Rule

In the next dialog box, select the menu Use a formula to determine which cell to format.

In the text box Format values where this formula is true, enter the following WEEKDAY formula to determine whether the cell is a Saturday (6) or Sunday (7):
=WEEKDAY(B$5,2)>5

The parameter 2 means Saturday = 6 and Sunday = 7. This parameter is very useful to test for weekends.


Note: In this case, you must lock the reference of the row so that the conditional format will work correctly in the other cells in this table.

Then, customize the format of your condition by clicking on the Format button and you choose a fill color (orange in this example).


Click OK, then open Conditional Formatting> Manage Rules



Select This Worksheet to see the worksheet rules instead of the default selectionIn Applies to, change the range that corresponds to your initial selection when creating your rules to extend it to the whole column.

Now you will see a different color for the weekends. Note: This example shows the result in the Excel Web App.

Highlighting holidays
To enrich the previous workbook, you could also color-code holidays. To do that, you need a column with the holidays you’d like to highlight in your workbook (but not necessarily in the same sheet). In our example, we have US public holidays in column AH (as related to the year in the cell B2).

Again, open the menu Conditional Formatting > New Rule. In this case, we use the formula COUNTIF in order to count if the number of public holidays in the current month is greater than 1.
=COUNTIF($AH$4:$AH$16,B$5)>1
Then, in the dialog box Manage Rules, select the range B4:AF11. If you want to highlight the holidays over the weekends, you move the public holiday rule to the top of the list.

This example in the Excel Web App below shows the result. Change the value of the month and the year to see how the calendar has a different format. 
Highlighting delays
In case we want to change the color of cells based on our approach on a date again, we will use conditional formatting to make it work for us.
In the following example, we show:
  • yellow dates between 1 and 2 months
  • orange dates between 2 and 3 months
  • purple dates more than 3 months
We then construct three rules conditional formatting using formula DATEDIF . Respectively for the three cases the following formulas:
=DATEDIF($B2,$E$2,”m”)>0
=DATEDIF($B2,$E$2,”m”)>1
=DATEDIF($B2,$E$2,”m”)>2

In the Excel Web App below, try changing some dates to experiment with the result.
Color scales
Rather than choose a different color set for each period in our timeframe, we will work with the option of color scales to color our cells.
First, go into a new column (column E), calculate the difference in number of days in a year again with the DATEDIF formula and the parameter “yd”.
=DATEDIF($D2,TODAY(),”yd”)
Then choose the menu Conditional Formatting> New Rule option Format all cells based on their value and choose the following options:
  • Scale = 3 colors
  • Minimum = 0 red
  • Midpoint = 10 yellow
  • Maximum = 30 white


The result is a gradient color scale with nuances from white to red through yellow.  The closer to 0, the more red it will have, the closer to 10 the more yellow, and the closer to 30 the more white.  In the Web App below, try changing some dates to experiment with the result.

Excel is Fun...


MS Excel Quiz - 1

 1. You can auto fit the width of column by

 A) double clicking on the column name on column header
 B) Double click on the cell pointer in worksheet
 C) Double clicking on column right border on column header
 D) Double clicking on the column left border of column header


2. Long text can be broken down into many lines within a cell. You can do this through

 A) Wrap Text in Format >> Cells
 B) Justify in Edit >> Cells
 C) Text Wraping in Format >> Cells, Layout tab
 D) All of above


3. MS Excel provides the default value for step in Fill Series dialog box

 A) 0
 B) 1
 C) 5
 D) 10


4. When a row of data is to be converted into columns

 A) Copy the cells in row, select the same number of cells in row and paste
 B) Copy the cells in column then choose Edit >> Paste Special, then click Transpose and OK
 C) Copy the cells then go to Format >> Cells then on Alignment tab click Transpose check box and click OK
 D) Select the cells then place the cell pointer on new cell and choose Edit >> Paste Special, mark Transpose check box and click OK.


5. Ctrl + D shortcut key in Excel will

 A) Open the font dialog box
 B) Apply double underline for the active cell
 C) Fill down in the selection
 D) None of above


6. The short cut key Ctrl + R is used in Excel to


 A) Right align the content of cell
 B) Remove the cell contents of selected cells
 C) Fill the selection with active cells to the right
 D) None of above


7. The command Edit >> Fill Across Worksheet is active only when


 A) One sheet is selected
 B) When many sheets are selected
 C) When no sheet is selected
 D) None of above


8. Which of the following series type is not valid for Fill Series dialog box?

 A) Linear
 B) Growth
 C) Autofill
 D) Time


9. Which of the following you can paste selectively using Paste Special command?


 A) Validation
 B) Formats
 C) Formulas
 D) All of above


10. Paste Special allows some operation while you paste to new cell. Which of the following operation is valid?

 A) Square
 B) Percentage
 C) Goal Seek
 D) Divide


11. Edit >> Delete command

 A) Deletes the content of a cell
 B) Deletes Formats of cell
 C) Deletes the comment of cell
 D) Deletes selected cells


12. To remove the content of selected cells you must issue ______ command

 A) Edit >> Delete
 B) Edit >> Clear >> Contents
 C) Edit >> Clear >> All
 D) Data >> Delete


13. The Delete key of keyboard is assigned to which command in Excel?


 A) Edit >> Clear >> Contents
 B) Edit >> Clear >> All
 C) Edit >> Delete
 D) All of above


14. If you need to remove only the formatting done in a range (numbers and formula typed there should not be removed), you must 

 A) From Edit menu choose Clear and then Formats
 B) From Edit menu choose Delete
 C) Click on Remove Formatting tool on Standard Toolbar
 D) Double click the Format Painter and then press Esc key in keyboard


15. By default Excel provides 3 worksheets. You need only two of them, how will you delete the third one?

 A) Right click on Sheet Tab of third sheet and choose Delete from the context menu
 B) Click on Sheet 3 and from Edit menu choose Delete
 C) Both of above
 D) None of above


16. Which of the following action removes a sheet from workbook?

 A) Select the sheet, then choose Edit >> Delete Sheet
 B) Select the sheet then choose Format >> Sheet >> Hide
 C) Both of above
 D) None of above


17. While Finding and Replacing some data in Excel, which of the following statement is valid?

 A) You can Find and Replace within the sheet or workbook
 B) Excel does not have option to match case for find
 C) Both are valid
 D) None are valid


18. Which of the following is not true about Find and Replace in Excel

 A) You can search for bold and replace with italics
 B) You can decide whether to look for the whole word or not
 C) You can search in formula too
 D) You can search by rows or columns or sheets


19. You can move a sheet from one workbook into new book by

 A) From Edit menu choose Move or Copy sheet, mark the Create a ccopy and Click OK
 B) From Edit menu choose Move of Copy then choose (Move to end) and click OK
 C) From Edit menu choose Move or Copy then select (new book) from To Book list and click OK
 D) None of above


20. What is the short cut key to replace a data with another in sheet?

 A) Ctrl + R
 B) Ctrl + Shift + R
 C) Ctrl + H
 D) Ctrl + F


Answers

1-C, 2-A, 3-B, 4-D, 5-C, 6-C, 7-B, 8-D, 9-D, 10-D, 11-D, 12-B, 13-A, 14-A, 15-A, 16-A, 17-A, 18-D, 19-C, 20-C