0% found this document useful (0 votes)
27 views

DV Unit-II

The document discusses different types of conditional formatting that can be applied in Excel, including color scales, data bars, and icon sets. It provides steps to apply various predefined and customized conditional formatting rules to cells based on their values or formulas. This allows important or outlier values to visually stand out through formatting.

Uploaded by

vanya798949
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

DV Unit-II

The document discusses different types of conditional formatting that can be applied in Excel, including color scales, data bars, and icon sets. It provides steps to apply various predefined and customized conditional formatting rules to cells based on their values or formulas. This allows important or outlier values to visually stand out through formatting.

Uploaded by

vanya798949
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

DATA VISUALIZATION

Unit-II – Visualizations using formats


Trend-based conditional formats
Understanding conditional formatting

Conditional formatting allows you to automatically apply formatting—such as colors, icons,


and data bars—to one or more cells based on the cell value. To do this, you'll need to create
a conditional formatting rule.

Conditional formatting presets

Excel has several predefined styles—or presets—you can use to quickly apply conditional
formatting to your data. They are grouped into three categories:

 Color Scales change the color of each cell based on its value. Each color scale uses
a two- or three-color gradient. For example, in the Green-Yellow-Red color scale,
the highest values are green, the average values are yellow, and the lowest values
are red.

To use preset conditional formatting with Color Scales:

In our example, we have a worksheet containing Resource recovery and recycling rates data,
and we'd like to see which landfill percentage in different colors based upon their rates and
highest percent should be in red color and lowest percent should be in green color.
1. Select the desired cells for the conditional formatting rule.
2. From the Home tab, click the Conditional Formatting command. A drop-down menu will
appear.
3. Hover the mouse over the desired conditional formatting type, then select the desired
option from the menu that appears. In our example, we want to have different color
scales. So select Color Scales.

4. Now select the colors Red – yellow – Green Color Scale. This applies the color gradient to
a range of cells. The color indicates where each cell value falls within that range.

 Data Bars are horizontal bars added to each cell, much like a bar graph.
To use preset conditional formatting with Data bars:

In our example, we have a worksheet containing Resource Recovery Rates by Region data,
and we'd like to see which State by year is having highest or lowest percent by using Data
bars.
1. Select the desired cells for the conditional formatting rule.

2. From the Home tab, click the Conditional Formatting command. A drop-down menu will
appear.
3. Hover the mouse over the desired conditional formatting type, then select the desired
option from the menu that appears. In our example, we want to have Data bars. So select
Data bars, in that we will have Gradient Fill and Solid Fill, select them to add a coloured
data bar to represent the value in a cell

4. Now select the Green Gradient Fill. You can see that the higher the value, the longer the
bar in the cell
 Icon Sets add a specific icon to each cell based on its value.

To use preset conditional formatting for Icon sets:

1. In this example in want to set icons to the values of CAGR column. That is all negative
values should have red colored down arrow, all positive values shouls have green colored
upper arrow and yellow color for zeros.
2. Firstly, copy the values to the next column that is because not to disturb the actual values.
For that, type = in the next cell and select the value i.e.., -3.5% and click enter. Now copy
the formula to rest of the cells just by dragging the formula.

3. Select the desired cells for the conditional formatting to apply icon sets.
4. Click the Conditional Formatting command. A drop-down menu will appear. Hover the
mouse over the desired preset, then choose a preset style from the menu that appears.
Select any 3 scaled icon sets.
5. The conditional formatting will be applied to the selected cells.

6. But we are not getting the exact icons i.e.., for -0.2% we have to get red colored down
arrow but its yellow. So, we have to customize the icons.
7. Select the icons cells and go to conditional formatting and select manage rules. Manage
Rules is to create, edit, delete and view all the conditional formatting rules in the
workbook by using the Conditional Formatting Rules Manager.

8. Select the icon set we have applied previously then a Edit formatting Rule box appers.
Now change the Type to number for both green and yellow icon and change > 0 for green
icon and >=0 for yellow icon by selecting on drop down list. Finally check the Show icon
only check box , that is not to show any values in the cells except icons.Click OK.

9. Again, click OK. Final result will be as shown below

Value-based conditional formats


Instead of having the reader scan each cell, you can have Microsoft Excel do some legwork
using some rules. This allows Excel to apply a defined format to a range of cells that meet
specific criteria or conditions. These defined rules evaluate a cell value to see if it meets a
specific criteria. If the condition is met, certain formatting is applied to the cell.

The goal is to make important information stand out so you can find it easier.

To use conditional formatting for Bottom 10 items:

In our example, we have a worksheet containing Core waste Won PC data, and we'd like to
see the bottom 10 items to be stand out.
1. Select the desired cells for the conditional formatting rule.

2. From the Home tab, click the Conditional Formatting command. A drop-down menu will
appear.
3. Hover the mouse over the desired conditional formatting type, then select the desired
rule from the menu that appears. In our example, we want to highlight bottom 10 items
in green fill. So select Top/Bottom Rules. In that select the Bottom 10 items.

4. A Bottom 10 items box appears, in that select the 10 with Green Fill with dark Green Text.
Click OK.

5. Now, we can see the bottom 10 values has been highlighted with green.
Format Entire Row with Conditional Formatting
In Microsoft Excel, with a few easy steps, you can apply conditional formatting that checks
the value in one cell, and applies formatting to other cells, based on that value. For example,
if I select the state in the dropdown list then we can highlight the states data.
This technique can make key information stand out on your Excel worksheets.

Format the Cells


In this example, we'll colour cells blue, when we select the state in the dropdown box.
Follow these steps to get started with the conditional formatting rule:
1. Select the cells that you want to format, B5:I12 in this example -- the entire data set,
without the heading cells.
2. On the Ribbon's Home tab, in the Styles group, click the Conditional Formatting drop down
arrow. Next, near the bottom of the list, click the New Rule... command

3. New Formatting Rule Dialog Box


The New Formatting Rule window opens, where you can enter the conditional formatting
rule details. In the top section, Select a Rule Type, click on the last option:
Use a Formula to Determine Which Cells to Format

4. The lower section, Edit the Rule Description, changes automatically. Now, it shows a box
where you can enter your custom formula: Click in the box below the heading, Format
values where this formula is true.
5. Enter Conditional Formatting Formula
Any conditional formatting formula must be a test, that gives a TRUE or FALSE result. For
this conditional formatting rule, the formula will do a simple check:
6. Is the dropdown list state is matched with the state in the Selected cells in column B?
TRUE or FALSE
7. Row and Column Reference
Before you create a conditional formatting rule, it's important to check which cell is active
on the worksheet. If the formula will have cell references, they might need to refer to the
active cell's row and/or column.
In this example, cells B5:I12 are selected.
Cell B5 is the active cell
Formula should check the value in cells of column B-- the active cell's column
Formula would work for the active cell is =B5=K1
Formula will need the correct type of reference to cell B2
Relative or Absolute Reference

In Excel, a cell reference can be an absolute, relative reference, or mixed reference. Which
type of reference should be used in this conditional formatting formula?
Note: In a cell reference, a dollar sign ($) tells Excel to lock that part of the reference
Absolute: $B$5 -- both the column ($B) and the row ($2) references are locked with dollar
signs
All cells would check the value in worksheet cell B2
Relative: B5 -- neither the column or the row are locked with a dollar sign
All cells would check value in their own row

All cells would check the value in the column to their immediate right, because column B
is to the right of the active cell, A2

Mixed: B$5 - column is not locked, row is locked


All cells would check the value in cell in row 2
All cells would check the value in the column to their immediate right
Mixed: $B5 - column is locked, row is not locked
All cells would check value in their own row

All cells would check the value in worksheet cell B2


8. Enter Formula with Mixed Reference
For this formula, we need to use the last option, a mixed reference, with only the column
locked-- $B5. With that reference, the conditional formatting will work correctly, in every
cell that is selected, from B5:I12.
In the rule box, enter the formula shown below:
Start with = , then click on B5 cell. Now, Click fun+F4 twice to have mixed reference i.e..,
=$B5.
column reference is locked ($B), row reference is not locked (5), all cells will check the
value in their own row, in column B
Again type = and click on dropdown list cell (absolute reference). -- both the column ($K)
and the row ($1) references are locked with dollar signs. All cells would check the value
in worksheet cell K1
Now the formula turns to =$B5=$K$1. Click OK

9. Add Formatting
The purpose of conditional formatting is to highlight cells that meet the criteria rules. In
this example, the cells should turn blue, if the formula result is TRUE. That will highlight
the rows, so they're easy to spot in a long list.
Follow these steps, to set the formatting:

 In the New Formatting Rule dialog box, click the Format button.
 In the Format Cells dialog box, select the formatting options that you want.
 In this example a blue fill color was selected and white color font is selected.
 You could also select format options from the Border, and Number formatting tabs

Click the OK button, to close the Format Cells window


10. Check the Rule Settings
Back in the Conditional Formatting Rules Manager, the new rule settings are shown. Check
the formula, and the formatting preview, If everything looks correct, click the OK button,
to apply the rule change.

11. On the worksheet, the new conditional formatting rule is applied. Row with the state
selected in drop down list are highlighted with blue fill colour.
Incorrect Highlighting
If we use a relative reference -- B -- without the $ sign, the column reference would adjust
automatically, in each column of the selected range. Instead of referring to column B, each
column would refer to the column to its right. That would give incorrect highlighting with the
conditional formatting.

Existing Conditional Formatting Rule


If you want to change an existing conditional formatting rule, follow the steps below. Select
the cells where the original conditional formatting rule was applied – B5:I12 in this example
On the Excel Ribbon, click the Home tab. In the Styles group, click the Conditional Formatting
command. Next, at the bottom of the list of options, click on Manage Rules. There we can edit
the rules which we have wrote previously.
Macros for interactive Visualization
Macros are a set of programming instructions written in VBA, which automate a repeated and
standardized process in Excel and other Microsoft Office Applications, like Access,
PowerPoint, Word & Outlook.

What Is a Macro in Excel?

An Excel macro is an action or a set of actions that can be recorded, named, saved and
executed as many times as required and whenever desired. By using macros, we are able to
automate repetitive tasks associated with data manipulation and data reporting that must be
accomplished repeatedly.

Sample Data

In this example, we will add the headers and some formatting to our sample data and then
perform the same steps with the macro shortcut key.

Turn on Developer Tab

The Developer tab is hidden on the ribbon by default. To customize the ribbon, follow these
steps:

 Right-click on the ribbon, anywhere and select (by clicking) Customize the ribbon.
 Navigate to Customize the ribbon and place a check on the Developer checkbox.

Record a Macro

Now that we have the developer tab on our ribbon, let’s start recording our first macro in
Excel. To record a macro, follow these steps:

 On the Developer tab, go to Code group and click Record macro.


 The Record Macro dialog box will appear. Give your macro a name and assign the shortcut
which will activate the macro. Click Ok.

Note: Every step you perform from now on will be recorded by the macro.

Let’s now add headers and format them with some colors.

Once you are done, go back to the developer tab and click stop recording.

Your macro has recorded the steps, and you can now perform the same steps with the
shortcut key you have assigned in the Record Macro dialog box.
Add a Button to Run Your Macro

In Excel, you can create a button that will run your macro. To do that, follow the steps below:

 Go to illustrations > Shapes and select any shape. We will use a rectangle with rounded
corners.

 You can also insert a button by going to the Developer tab > Insert > Form Controls.

 Add the text to the shape by right-clicking the shape and selecting edit text.
 Right-click the shape and select Assign Macro.

Select the corresponding macro from the window and select (by clicking) Ok.
Consequently, whenever you select (by clicking) that shape, Microsoft Excel will activate and
run your recorded macro.
Visualizations with Sparklines and Shapes
The sparklines are also known as in-line charts. So the question is where do we use sparklines,
we can use them in situations where we want the graph/chart to be as near to the data as
possible. Mainly we write data in one row / one column and add a sparkline to the end of the
row or end of the column. Sparklines can be of many types: Line, Column and Win/Loss. An
example of a sparkline is as follows:

An example of sparkline
Method of adding sparkline:
Follow the below steps to add sparkline in Excel:

 Go to insert tab.
 Select the cell where you want to insert sparkline.

 Go to insert > Sparklines > Select option


 Select the range of cells for which you have to add a sparkline.
 Selecting the range of cells for the sparkline
 Click on the OK button, sparkline is now added in the selected cell.

Sparkline is added in the selected cell


Formatting the sparkline:

To format the sparkline, select the sparkline you want to format and then select the Sparkline
option on the menubar as shown in the picture below:
Formatting the sparkline
Using show submenu:
In the show submenu there are 6 options:

High Point: Marks the maximum point on the sparkline.

Low Point: Marks the minimum point on the sparkline.


First Point: Marks the leftmost (first) point on the sparkline.

Last Point: Marks the rightmost (last) point on the sparkline.


Markers: Marks all the edge points on the sparkline.

Negative Points: Marks the negative points in the graph with a different color which is
illustrated in the figure below:

Negative Points marker marks the negative points with different color
Using Style submenu:
In the style submenu, we can select the style of the sparkline, many options are available
(different variety of colors). We can also set the color of the sparkline and marker color using
Sparkline Color and Marker Color options.

Same steps for the line option of sparklines.

Visualizing Shapes in excel

You can add shapes to your spreadsheet to spark a little visual interest. By using the Shapes
menu, you can choose from dozens of different types of shapes.

Insert a Shape
1. Click the Insert tab.
2. Click the Shapes button.

The Shapes menu displays all the types of shapes available, organized into groups.

3. Select a shape to insert.

Now the cursor changes to a cross hair and is ready to draw on the sheet.

4. Insert the shape in one of two ways:

 Click anywhere on the page to insert the shape there.


 Click and drag anywhere on the page to place the shape while also controlling its size.
Some shapes have prominent features that can be adjusted; these shapes will have a yellow
adjustment handle.

Format a Shape
Once you’ve added a shape, you can use the Format tab to change its style, fill, outline color,
and effects.

1. Select a shape.

When you select a shape, the Format tab in the Drawing Tools ribbon group becomes
available. Double-click a shape to automatically switch to the Format tab.

2. Use the Shape Style options on the Format tab to change the style, fill color, outline, or
shape effects.

 Select a style from the Shape Styles gallery, or click the gallery’s More button to see
all available styles.
 Select a shape fill color, weight, or dash pattern.
 Select a shape outline color to change the color of the selected shape. You can also fill
it with a gradient, picture, or texture pattern.
 Apply various shape effects such as shadow, reflection, glow, bevel, and 3D rotation.
Custom number formats

Number format?

A number format is a special code to control how a value is displayed in Excel. For example,
the table below shows 7 different number formats applied to the same date, January 1, 2019:

Input Code Result


1-Jan-2019 yyyy 2019
1-Jan-2019 yy 19
1-Jan-2019 mmm Jan
1-Jan-2019 mmmm January
1-Jan-2019 d 1
1-Jan-2019 ddd Tue
1-Jan-2019 dddd Tuesday
The key thing to understand is that number formats change the way numeric values
are displayed, but they do not change the actual values.

Where can you find number formats?

On the home tab of the ribbon, you'll find a menu of build-in number formats. Below this
menu to the right, there is a small button to access all number formats, including custom
formats:
This button opens the Format Cells dialog box. You'll find a complete list of number formats,
organized by category, on the Number tab:

Note: you can open Format Cells dialog box with the keyboard shortcut Control + 1.

General is default
By default, cells start with the General format applied. The display of numbers using the
General number format is somewhat "fluid". Excel will display as many decimal places as
space allows, and will round decimals and use scientific number format when space is limited.
The screen below shows the same values in column B and D, but D is narrower and Excel
makes adjustments on the fly.
How to change number formats
You can select standard number formats (General, Number, Currency, Accounting, Short
Date, Long Date, Time, Percentage, Fraction, Scientific, Text) on the home tab of the ribbon
using the Number Format menu.

Note: As you enter data, Excel will sometimes change number formats automatically. For
example if you enter a valid date, Excel will change to "Date" format. If you enter a percentage
like 5%, Excel will change to Percentage, and so on.

Where to enter custom formats


At the bottom of the predefined formats, you'll see a category called custom. The Custom
category shows a list of codes you can use for custom number formats, along with an input
area to enter codes manually in various combinations.
When you select a code from the list, you'll see it appear in the Type input box. Here you can
modify existing custom code, or to enter your own codes from scratch. Excel will show a small
preview of the code applied to the first selected value above the input area.

Note: Custom number formats live in a workbook, not in Excel generally. If you copy a value
formatted with a custom format from one workbook to another, the custom number format
will be transferred into the workbook along with the value.

How to create a custom number format


To create custom number format follow this simple 4-step process:
1. Select cell(s) with values you want to format
2. Control + 1 > Numbers > Custom
3. Enter codes and watch preview area to see result
4. Press OK to save and apply

Tip: if you want base your custom format on an existing format, first apply the base format,
then click the "Custom" category and edit codes as you like.

How to edit a custom number format


You can't really edit a custom number format per se. When you change an existing custom
number format, a new format is created and will appear in the list in the Custom category.
You can use the Delete button to delete custom formats you no longer need.

Structure and Reference


Excel custom number formats have a specific structure. Each number format can have up to
four sections, separated with semi-colons as follows:

This structure can make custom number formats look overwhelmingly complex. To read a
custom number format, learn to spot the semi-colons and mentally parse the code into these
sections:

1. Positive values
2. Negative values
3. Zero values
4. Text values

Steps to customize data with colors

1. Select the data.


2. Click control+1 ->number ->custom.

3. In type, write [green]00.0;[red]-00.0; then click OK.


4. Your data has been changed now i.e; positives to green, negatives to red and no zero.
Excel provides basic support for colors in custom number formats. The following 8 colors can
be specified by name in a number format: [black] [white] [red][green] [blue] [yellow]
[magenta] [cyan]. Color names must appear in brackets.

Conditionals

Custom number formats also up to two conditions, which are written in square brackets like
[>100] or [<=100]. When you use conditionals in custom number formats, you override the
standard [positive];[negative];[zero];[text] structure. For example, to display values below
100 in red, you can use:

[Red][<100]0;0

To display values greater than or equal to 100 in blue, you can extend the format like this:

[Red][<100]0;[Blue][>=100]0
To apply more than two conditions, or to change other cell attributes, like fill color, etc. you'll
need to switch to Conditional Formatting, which can apply formatting with much more power
and flexibility using formulas.

Colors by index

In addition to color names, it's also possible to specify colors by an index number
(Color1,Color2,Color3, etc.) The examples below are using the custom number
format: [ColorX]0"▲▼", where X is a number between 1-56:

[Color1]0"▲▼" // black
[Color2]0"▲▼" // white
[Color3]0"▲▼" // red
[Color4]0"▲▼" // green etc.

The triangle symbols have been added only to make the colors easier to see. The first image
shows all 56 colors on a standard white background. The second image shows the same colors
on a gray background. Note the first 8 colors shown correspond to the named color list above.

You might also like