Chapter 3
Chapter 3
3 Filtering
Sorting and
Learning
Objectives
referencing
Understand the concept
of cell
Sort and filter the data conditions
some
Format data based on
address, which nc oDInaton
i1s
CELL REFERENCES
You can use three diferent
formula, it is known as cell reference.
d cell address is used in a absolute and mixed. Each
cell reference
"cn Or Cell (or range) references in a formula: relative,
anotner.
Pes
Denaves differently in a formula when the formula is
copied from one cell tO
Relative Reference
usually based on the poSition
when you write a formula, the reference to a cell or range is
automatically changes the cell references
relative to the cell. When you copy this formula, Excel
where you paste the formula. The
(column letters and row numbers) in relation to the position
copying the formula is known as relative cell reference
and this
cell reference that changes on
type of cell referencing is called relative referencing.
To understand relative referencing, consider the following worksheet in which temperature
in
Celsius from Monday to Friday is given and we have to calculate the temperature in
Fahrenheit.
J9
C
A
Day Temperature in Temperature in
Celsius Fahrenheit
2 Monday
20
3 Tuesday
Wednesday 75
4 50
Thursday
Friday 10
26
To do this, follow these steps.
1. Write theformula =(B219)/5+32 in cell C2.
2. Press the Enter key. This displays the result in the cell C2.
On the Home tab, click the Copy button (
3. Capy) in the Clipboard group.
4.
Click in the cell C3 and press the Enter key. You
can see in the Formula Bar that the cell
reference in the formula has changed from B2 to B3
C3
(83 9)/5+32
A
839)/5 +32
Absolute Reference
Thecell reference that is fixed and does not change on copying the formula is known as absolute
cell reference and this type of cell referencing is called absolute referencing. To
make a cell
reference absolute, two dollar signs are used in the cell address: one before
the column letter
and the other before the row number. For example, the absolute reference of cell A3 is $A$3.
Tounderstand absolute referencing, consider the below worksheet. Suppose we are to calculate
average of temperature in Celsius and Fahrenheit on each day. To do this, follow
these steps.
1. Write formula = (B2+$C$2)/2 in cell D2.
2. Press the Enter key. This displays the result
in the cell D2. B3+$C$2)/2
D3
3. Now, copy this formula in cell D3. You will A B
D
Day Temperature in Temperature in Average
see in the Formula Bar that the formula Celsius Fahrenheit Temperature
Monday 113
becomes=(B3+$C$2)/2. Notice that only Tuesday 66.5
Wednesday
the relative part of the reference changes, 75 67
Thursday 50 122
while the absolute part remains the same. 6 Friday 10
27
Mixed Reference referencCe, 1t 1s nown as
and the absolute createa
cell reference contains both the relative
En a
ted cell reference and this tvpe of
cell referencing is called mxed
the column
letter or bef
efore the
before row part
mixed cell reference, a single dollar sign is used either which implies that the ofthe
i
reference
row number. For example, F$4 is a mixed cell
reterence is absolute, while the column part is relative =(B2+SC2)/2 in cell D2 and then
the formula the absolute part
For example, in the previous case, if we enter =(B3+SC3)/2. Notice that
becomes that is row
formula in cell D3, the formula same, while the relative part,
tnis
oT cell reference SC2, that is,
column letter C remains
number, changes from 2 to 3.
83SC3/2
Average
en ature 1
Day Temperanire
Fae hert
13
Monday
Tuesday 157
Wednesday 122
Thursday so
Friday
22. On the Home tab, click the Sort & Filter button ()in the Editing Sort &
Filter
group. A drop-down list appears. 2 Sort Smallestto Largest
Sgrt Largest to Silest
E3 Custom Sort..
YaEiter
Slear
Reapply
28
3. Select Sort Smallest to Largest option from the list to arrange
the data in ascending order.
OR
Select Sort Largest to Smallest option to arrange
the data in descending order.
The data is sorted as per the selected option. The following worksheet
shows the data sorted in
the descending order of Salary.
f52000
Emp ID Emp Name
Department Salary
2 E203 Anil Mahadevan HR
E202 Ritika Chugh 52000
Marketing 50000
4 E201 Deepika Mahajan Finance
45000
5 E205 Sonika Sharma Marketing 45000
E206 Mehul Gupta Finance 39000
E204 Suyash Chopra HR 36000
Fiter YAdvanced
Data
Consolidate
Validation Group
Ungroup
ll Edit Links Text to Remove
Columns Duplicates What-f Analysis Subtotal
Connections Sort& Filter Data Tools Outline
NOTE
Observe that when you select
numeric data to sort, you will find Sort Smallest
to Largest and Sort Largest to Smallest
options in the & Filter drop-down
list. However, when youselect alphanumeric data to sort,Sort
these options appear as
Sort A to Z and Sort Z to A, respectively.
29
(in the Editing grour and
Sort & Filter button
2. On the Home tab, click the sele
list.
Custom Sort option from the drop-down
OR
the Sort & Filter groun
Click the Data tab and then click the
Sort button ()in
appears.
The entire range gets selected and
the Sort dialog box
s
field the basis of which you want to sort from theSort
3 Under Columns, select the on b
drop-down list. For example, select Department.
select A to Z from the drop-down list.
liss
4 Under Sort On, select Values and under Order,
ort
My data has þeaders
Copy level pbons
a1edd LevelXDelete Level
Order
Column Sort On
Sort by Department
V Values
Cancel
5. To sort by more than one field, lick the Add Level button. A new row appears in the Sort
dialog box. Under Column, select Salary, under Sort On, select Values and under Order,
select Largest to Smallest. Similarly, you can add more fields for sorting
Sort
OK Cancel
. Click OK. The data is sorted in the ascending order of Department and in
the descending
order of Salary in each department.
A C D
Emp ID Emp Name Department
1 Salary
E201 Deepika Mahajan Finance 45000
E206 Mehul Gupta Finance 39000
E203 Anil Mahadevan HR 52000
5 E204 Suyash Chopra HR 36000
6 E202 Ritika Chugh Marketing 50000
E205 Sonika Sharma Marketing 45000
30
Tryin Lab
Open MS Excel program and perform the followingsteps
1. Type and format the data as shown in the following
figure.
Class Vi
StudentHame Age Marks Obtained Total Marks
RIshita %age of Marks
500
Anarny
Mehul 12
Prateek 98
AbhimanyYu
Mitali
Aarush 380
Dipali
Mayuresh 00
488
FILTERING DATA
Excel provides a useful feature called Filter that lets you view only the selected data a
in range,
while hiding the unwanted data temporarily. Filtered data displays the rows that meet the
criteria specified by you and hides the remaining rows.
Filtering is a faster and an easier way to retrieve the data based on some specified condition.
Unlike sorting, it does not rearrange the data. It just temporarily hides the rows that you do not
want to view. You can also edit, format or print the filtered data without moving or rearranging
it.
To filter data in a worksheet, follow these steps.
1. Select any cell in the range of cells you want to filter
A B D
Emp l Emp Name Department Salary
E201 Deepika Mahajan Finance 45000
3 E202 Ritika Chugh Marketing8 50000
4 E203 Anil Mahadevan HR 52000
5 E204 Suyash Chopra HR 36000
6 E205 Sonika Sharma Marketing 45000
E206 Mehul Gupta Finance 39000
31
Editng group and se
Filter button (2)
in the
tab click the Sort &
On the Home tab,
TEome
Filter option from the list.
OR
the Sort & Filter group
click the Filter button (in
Ck the Datatab and then
OR
Press Ctrl+ Shift+ on the keyboard
L
These arro
each column heading.
menu arrows () appear next to
down
indicate that the filter is enabled but not applied yet.
Sort &
Filter
Sort Ato Z Department
Salary
Empl Emp Name 45000
Sgrt ZtoA
E201 Deepika Mahajan Finance s0000
Custom Sort... E202 Ritika Chugh Marketing
52000
HR
E203 Anil Mahadevan
Y Fiter 36000
s E204 Suyash Chopra HR
any drop-down arrow to apply a filter to that column. For example, it you want
to
3.
arrow next
display records of only those employees who earn 45000, click the drop-down
to the Salary field. A list of various options appears
The Select All check box is by default selected. Click this check box to deselect all the
options.
5 Select the check box for the option 45000.
Marketing
Select 4
030
Can
6. Click OK. The rows of employees contalning 0u0 in the salary field are displaved
in the
worksheet.
32
Filter button (T) next to the Salary field indicating
You can see a that a filter has been applied.
clear the filter criteria, follow any of these
If you want steps.
the Filter button and then select Clear Filter
From "Salary" option from the list
displayed.
Fper by Color
Number Eiters
13 Search Sort&
(Select Al) Filter
J36000
]39000
2 Sort Ato Z
10
17
45000
5O000 ASgnt Zto A
18 O52000
EHCustomSort...
20
Cell Referer YaEilter
H4H
Ready 2 of 6 records to giea
OK Cancel
Reappy
Vou can also remove or turn off a filter, if you need. For this, click the Filter option in the Sort
&
Filterdrop-down list once again. You can als0 press Ctrl +Shift + L on the keyboard to turn
off filtering
Custom Filtering
Custom fltering allows you to filter data based on certain specific conditions. For example, if
vou
want to view the employees whose salary is between 35000 and 45000, follow these steps.
Select any cell in the range of cells you want to filter.
. On the Home tab, click the Sort & Filter button ()in
Fiter
the Editing group and select
Filter option from the list.
OR
Click the Data tab and then click the Filter button (,)
Fiter
in the Sort &F group.
OR
Press Ctrl + Shift + Lon the keyboard.
3. Click the drop-down arrow next to the Salary field. A list of options appears.
4 Point to Number Filters option. A submenu appears which lists various comparison
operators to choose from for filtering your data.
5. Click Custom Filter option in the submenu.
33
2 45000
H Above Average
Cel Reteren
Reddy Belgw Averag9
Custom Eitel.
OK Cancel
Custom AutoFilter
OK Cancel
D
1 Emp Il Emp Name Department Salary
2 E201 Deepika Mahajan Finance 45000
5 E204 Suyash Chopra HR
36000
6 E205 Sonika Sharma Marketing
45000
E206 Mehul Gupta Finance 39000
Try in Lab
Open the Excel workbook you created earlier and
filter the data to view the
those students who have got more than 85% marks. To do this, perform records of only
the following sten
1. Select the data in the range A2:D11. teps.
34
k the drop-down arrow next to the %age of Marks
Click field, point to Number Filters
3 Ccin the list and select Greater Than Or
option in th Equal To option in the submenu.
Specify the value 85 in the Custom AutoFilter dialog box.
Custom Autofiter
tey
thon 1ows where:
%g ofMas
A Dsest
sgester tharn cu eguad to 8
May
eer an
bnd
les Then r fas 14
etg
Use 7 to represerit ony
srde dran scter
Ue to represent any sries of
daracters
ick OK. You will see the filtered data in the worksheet.
5.
Clas VIs
StudentMam Total Mark
AgeMarks Ottaind%age of Mark
Rishita
4 Anany4 12 474 4.8
7 Abhimanyu
7
9 Aarush 3
11 Mayuresh
cONDITIONAL FORMATTING
Cditional formatting is a feature that allows you to format the cells in a worksheet according
the conditions you specify. For example, you can highlight the cells or a range of cells with
acnecificcolour depending on whether they contain value greater than, less than or equal to a
ertain value. This helps you to analyse the data in an effective way.
Conditional formatting provides different options to set the format of cells. These options are
given below.
Highlight Cells Rules: This option highlights only those cells which satisfy the
given
condition. For example, the cells which contain value greater than 80 are highlighted in
the following worksheet.
Conditional Fomatting
35
items, 10 top
Top/Bottom Rules This option highlights the cells containing top
10
D
P
values, above average values or bel
Cent values, bottom 10 items, bottom 10 per cent
averagevalues. For example, the cells of top 10 values are highlighted in the followi
worksheet.
Conditionat Formatin9
Top/Botomules
Top 10 Mems
Data Bars: This option highlights the cells by placing coloured bars beside the values. lhe
size of bar indicates the value in a cell. The higher the cell value, the longer will be the bar,
Or example, the following worksheet shows Orange Data Bar added to the cell values.
h Conditional Formatting
Highlight Cells Rules
Iop/Bottom Rules
Color Scales
A B
1 Item Sold Jan Feb Mar
con Sets Solid Fill LCD/LED 85 70 90
Washing Machine 45 67 56
New Rule.. Refrigerator 87 69 100
Clear Rules Food Processor 78 83 67
Air Conditioner 75 90
Manage Bules... Microwave Oven 42 53
More Rules Air Purifier
Color Scales: This option highlights the cells by applying a colour gradient to the cell
values. The colour in each cell indicates where each cell value falls within that ranoe
You can choose either a two-colour or a three-colour scheme. For example, the following
worksheet shows Blue-White-Red Color Scale applied to the cell values.
36
pehhs Cel fiutes
e/otom Rtes
Rem Sold
wDAED n Feb Mar
Washing Mathine
tefrigerator
Food Processor
Air Conditioner 07
ore Bdes Miowave Oven 99
Mantge te Air Purifier
we
hp
.g
A
8AirPurifier 38 49
Suppose you want to highlight the cells which contain the value less than 75. To do this, follow
these stepS.
1. Select the desired range of cells.
On the Home tab, click the Conditional Formatting button (condtiona formating ) in the Styles
2
group. A drop-down menu appears.
3 Pointto Highlight Cells Rules option in the menu and then select Less Than option from
the submenu that appears. The Less Than
Less Than
dialog box appears.
Format cells that are LESS THAN
4. Type 75 in the box on the left and choose the 75 withelow l ih DarkYelowYext
desired colour option from the drop-down
OK Cencel
list on the right.
37
C
75 appear ltem Sold Jan Feb
value less than M
Click OK. The cells with
89 70
LCD/LED
shown.
formatting specified by you as Washing Machine
45 7
in the Refrigerator
87 69
4 78 83
Food Processor
5 Air Conditioner
65 5
55 12
Microwave Oven
7 Purifier 38
8 Air
Conditional Formatting
Color Scales
Ekon Sets
Rule
Bew
gear Rules Clear Rules fio
ed e
Clear Rules from phlre She
Manage Bules..
Clear Rules from fhia fae
CGer Rules trom
Try in Lab
Create an Excel worksheet with the following data and apply conditional formatting to
highlight the rows with total marks greater than 255 in orange colour.
G
Roll No Student Name Test l Test il Test lil Total Marks
Rahul 98 89 277
2 Anika 78 85 82 245
3Swati 86 89 256
Deepika 9 68 223
5 Manan B0
6 Sukant
34 275
7 Priya 69 5 70 04
8 Abhishek 2 S8
b4
38
Clickhe
the Filltab, select orange colour from the colour palette and then click OK.
6 FocmatCel
Rule
Formatting
New Nunber FantBorder
1pe:
SelectaRuie valuess Background Color:
nColor:
Patern
based on their
Format al cels contain
o Color Automatc
ony cels that attern Stye
Format ar bottom ranked vakues
top
Fornst ony above or belowa
only vakues
that are
Format values
unique or duplcate
Format ony widh cels to
format
formula to determine
Uea Desapton:
Bdit the
Rule
where this fomula is true
FAEffects re Colors
mat values
2>25s anple
Previewc
No Format Set Format.
Ge
Cancel
OK Cancel
QUICK
RECAP
When a cell address is used in a formula, it is known as cell reference.
You can use three different types of cell (or range) references in a
formula: relative, absolute and mixed.
Sorting refers to arranging data either in ascending or descending
order
Excel provides a useful feature called Filter that lets you view only the
selected data in a range, while hiding the unwanted data temporarily.
39
specific
ific conditions
filter data based on certain
Custom filtering allows you to wo
format the in aa workshe
cellss in
you to
Conditional formatting is a feature that allows helps you to analyse se the data
dat in
specify. This a
according to the conditions you
effective way.
TEACHER'S NoTE
references with examples.
Explain to students the concept of cell Also, tellthem
how data can be sorted in different ways.
Demonstrate to students criteri
filtered display only the selected data satistying certain ia
how data can be to ue
in various ways
the selected data using
Show them how they can highlight only
conditional formatting.
(from 0 to 9 or A to Z).
d. You can sort data on more than one field using the dialog box.
2 In an Excel worksheet, a formula in the cell A2 is copied to the cell C2. What will the formula
become in C2 if the formula in A2 is:
a. =B2+C3
b. =B$2+$C3
c. =$B$2+C3
d. -B2+SsC$3
e. =$B2+C$3
40
correct option.
Circle the
ata
. the icon used to filter the dato
Identifythe
Y (i)
R (ii)
Which option of Cond
nditional Formatting lets you
highlight the cells containing above
b. values?
average
Top/Bottom Rules (i) Data Bars
() (i) Highlight Cells Rules
Excel allows you to sort data in
C.
Ascending order (i) Descending order
) (ii) Both () and (i)
which of the following is an absolute cell reference?
Which
d.
FS (i) SFS SFSS
(
which feature of Excel allows you to arrange data in a specific order?
Sorting (i) Filtering ii) Conditional formatting
tick () for the correct statements and a cross (*) for the wrong ones.
Bars option highlights the cels by placing coloured bars beside the values.
a Data
Once you have applied hlter to data, you cannot remove it.
cCustom filtering allows you to filter data based on certain speciñc conditions.
you to sort data on more than one field.
d Excel does not allow
both are mixed cell references.
e P$3 and $P3
Answer the questions.
5
a. How can we make a cell address absolute?
b. What is sorting? What are the two ways of sorting data in Excel?
h. Can you clear conditional formatting from data, once applied? If yes, how?
6. Application-based questions.
a. Consider the given worksheet and answer the following questions.
) What will you do so that Student Name starting with Z is at the top and the one
starting with A is at the bottom?
41
sport in the increasing order
want the list of students enrolled in cach
of
(01) 1f we
what will you do?
B
C
Sport Name
Monthly Fee
Student Name
1200
Aditya Cricket
800
Ruhani Gymnastics
4 Sourabh 700
Tennis
Sonam 900
Badminton
6 Payal 600
Tennis
Abhay 600
Gymnastics
8 Kamakshi Badminton 1100
9 Vansh Cricket 1500
10 Kanak Tennis 1000
11 Anurag8 Cricket 1300
s alyani
OW,
prepared the results of annual examination of 50 students in an Excel workshee
she wants to see the data of only those students who have got more than 85% marks
) Which feature should she use
to do this
(1) Name the tab and group that
contains the option to use this teature.
(ii) How will you turn off this feature?
C. Rubin is a manager in a mall. He has
prepared a performance report of different sales
executives working there. Now, he
wants to highlight the names of top five pertormers
Which option should he use to
do this?
A B
C D
Quarter Sales Record
Salesman Code Qtr1 Qtr2 Qtr3 Qtr4 Total Sales
sCO01 70 80 89 76 315
4 SCO02 90 85 90 89 354
5 SCO03 56 56 67 72 251
6 SCO04 76 65 76 79 296
7 SCOO5 80 78 89 85 332
8 SCO06 78 87 98 93 356
9 SCO07 45 66 76 71 258
a. highlight the cells showing quarterly sales below 75 in dark green background.
43