0% found this document useful (0 votes)
30 views14 pages

Book

This document provides an overview of using Excel as a database, covering key concepts such as fields, records, and the structure of a database. It explains how to perform operations like adding, searching, deleting, sorting, and filtering data using forms and various Excel features. Additionally, it includes step-by-step instructions for sorting data based on single and multiple columns.

Uploaded by

mca2023081
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)
30 views14 pages

Book

This document provides an overview of using Excel as a database, covering key concepts such as fields, records, and the structure of a database. It explains how to perform operations like adding, searching, deleting, sorting, and filtering data using forms and various Excel features. Additionally, it includes step-by-step instructions for sorting data based on single and multiple columns.

Uploaded by

mca2023081
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/ 14

2 Excel asaDatabase

In the previous grade, you have


learnt how to do calculations in Let's Learn About
Excel. Apart from performing Using a Form to Enter Doto
mathematical calculations, yoU Can Searching aRecord
also store a huge amount of data Deleting a Record
in MS Excel, In this " Sorting Data
chapter, you
will learn about storing, " Filtering Data
maintaining,
sorting, and filtering data in an Excel " Data Validation
worksheet.

Database is an organized collection of


a database is made up of information. It has a definite structure. The structure nf
Fields and Records. All the data that you store must fit into that
structure.
A database helps youto
organize, modify, view, and edit data. Some examples of
are listed below: database
A
phone diary
An address book
Alibrary catalogue
Students' record
To store all the above
databases, you need to create adifferent structure for each. Let us
create a sample database (Fig. 2.1) in order to
understand the concept of database in Exce.
Field

A B D
Students' Detail
2 Roll No Name Age Activity sField Name
3 1 Armaan 12 Vocal Music
2 Chetan 11 Dance
Record 5 3 |David 12 |Chess
6 4 Farah 12 |Cricket
7 5
8
Harpreet 11
|Skating
6 |Jasleen 11 Vocal Music
Fig. 2.1 Asample of database
Adatabase has three main components which are described in the Table 2.1.
Table 2.1 Components of a database
Component Explanation
Field A field is a column that contains only one
type of data. For example,
Roll No., Name, Age, and Activity are different fields.
Record A record appears as a row in a database. It is
composed of two or more
fields. contains data and information about a person, an item, or an
It
organization. For example, 1, Armaan, 12, and Vocal Music together
form a record.
Field Name A field is considered a column in a database, therefore, field name is also
referred to as 'column label'. All the field names appear in a single row
above the data. A field can have only one field name. Each field name
must be unique. For example, Roll No, Name, Age, and Activity are
four different field names.

USING A FORM TO ENTER DATA

Suppose you have created a database in MS Excel, and now, you want to perform some
operations on it, such as adding, searching, deleting,and modifying a record. In a huge
database, it is always advisable to use the Form feature to perform such operations.
Using the Form' feature, you can work on an individual record ata time. Aform is asmall
screen that contains the fields of a database along with the space to add, modity, or view
a record.)A form also contains certain command buttons to perform various tasks. When
you enter or modify any information in aform, the data automatically gets updated in the
database.(Bydefault, the Form button is present on the Quick Access Toolbar.

Let's Review >>>»


Fill in the blanks.
1. is an organized collection of information.
2 A contains only one type of data in a database.
3. The Form button is present on the by default.
4. A is a column label in a database. 21
5. A is composed of twO or more fields.
Adding New Record in a Form
Before using the Form feature, make sure that you have created the struUcture of
the
in Excel sheet, i.e., a worksheet must have defined field names. These field
names are used
as Labels to enter records in aform. Ensure that there is no blank row or column datobosA
range of data. within the
Forn buton
lo entera new record usinaaform, follow these steps:
I. Select the cell A2. Click on the Form button on the
Quick Access Toolbar.
2. The Sheetl dialog box appears (Fig. 2.2).
It contains the record of the first row in the
database. Click on the New button. Info Box >»>»»
3. Anew blank form appears (Fig. 2.3). Fill the You cannot add a new
record in on
torm to add a new record in your database, empty Excel sheet using the Fom
and then press Enter (Fig. 2.4). You will notice, feature. Therefore, before adding
anew record is added at the end of the range a new record in the form, an Excel
or table (Fig. 2.5). worksheet must have defined field
4. Click on the Close button (Fig. 2.4) to close names. Using the Form feature, you
can only add records not fields.
the form.
Sheet1 X Sheetl Sheet1
Roll No: 1 of 6
Roll No: New Record Rgll No: 7 A New Record
Name Armaan New
Name: Name: Mahesh
Age 12 Delete Age: 11 DEeE
Acivity:Vocal Music Restore Aghvity: Retore Activity:Fine Art Restore
Find Prev Find Prev Find Prer
Find Ned
Find Net And Net
Citeria
Criteria Criteria

qose Cose Close

Fig. 2.2 Sheetl dialog box Fig. 2.3 The blank form Fig. 2.4 Addinga new record

A B D
Students' Detail
Roll No Name Age Activity
nmnoo
3 1 Armaan 12 Vocal Music
4 2 Chetan 11 Dance
5 3 David 12 Chess Ava's Cool Tip »»)
4 Farah 12 Cricket on
6
While using aform, you can click
7 5 Harpreet 11 |Skating
6 Jasleen 11 Vocal Music the Find Prev and Find Next buttons
22
New
9 7 |Mahesh 11 Fine Art to access the previous and next
Record
records, respectively in the dotabase.
Fia. 2.5 New record added in the databose
Info Box >>>
To remove any unwanted duplicate value from the range, use the Remove Duplicates buton
available in the Data Tools group on the Data tab.

SEARCHING A RECORD
n adatabase,you can quickly search a specific record Sheet1 ? X
using the Form feature. To do so, follow these steps: Roll No: 6 of 7
1. Click anywhere in the database range, and
Name: |Jasleen New
click on the Formn button
Age: 11
Delete
2. The Sheetl dialog box appears. Click on the
Activity: Vocal Music Restore
Criteria button in the dialog box to search a
record by entering data in a uniquely identified Find Pre
field, such as Roll No. Find Next
3. In the Roll No text box, type 6 and Criteria
press Enter (Fig. 2.6).
Jose
If the entered value matches any record in the database,
then it will be displayed. Else, the first record will appear
in the form. Fig. 2.6 Searching a record

DELETING A RECORD
To delete a record using the Form feature, follow these steps:
1. Click on the Form button. The Sheetl dialog box appears.
2. Go to the desired record by using the Find Prev or Find Next buttons.
3. Once you reach the record to be deleted, click on the Delete button. Excel prompts
a confirmation box (Fig. 2.7).
4. Click on OK to delete.

Microsoft Excel X

Displayed record will be permanently deleted.

Cancel
25
Fig. 2.7 Warning message
Nore:|Remember, once a record is deleted from the datagbase, it cannot be recovered.
SORTING DATA

MS Excel allows you to rearrange the data numerically or alphabetically, and on the basis of
dote, color, and so on. Rearranging data in a specific order is called sorting.

Single Column Sorting


To sort the data on the basis of single column is known as Single column sorting. You can
sort the data on the basis of alphabetical values or numerical values.
Sorting Text Value A BCD E

1 Marks Out of 100


To sort data using text value, follow these steps: 2 Roll No Name Maths Science Computer Total
3 1 Harleen 76 90 80 246
1. Open a new worksheet and type the 4 Daisy 50 56 183

data (Fig. 2.8). 6


3
4
Fatima
Bhavesh
80
49
89
56
90
65
259
170

2. Select the cell range where you wish to 7 5 Shiv 98 86 269

sort the data, i.e. A2:F7. Fig. 2.8 Sample database for sorting
3. Click on the Data tab. Review View 9 Tell me what you want to do..
Formulas Data

4. Click on the Sort button in the Show Queries lConnections Clear

From Table
Refresh
Properties
1 Sort Filter LReapply
Sort & Filter group (Fig. 2.9). Jew
Jery L Recent Sources
Get & Transform
All- Edit Links

Connections
tAdvanced
Sort & Fiiter

5. The Sort dialog box appears (Fig. 2.10). Fig. 2.9 Selecting Sort button
Under the Column section, click on
the Sort by drop-down arrow. Select the column or field name on the basis of
which you wish to sort the data. Here, we have selected the Name field.
In the Sort On drop-down list, Values option is selected by default.
In the Order drop-down list, select the A to Z option.
selected. Activating this
Note: Make sure that My data has headers checkbox is
list.
option shows the 'Field names' in the Column Sort by drop-down
(Fig. 2.11). You willobserve that the
6. Click on OK. The sorted database will appear
in Name field is sorted in alphabetical order, i.e. from A to Z. The data in the
data
rest of the cells changes, accordingly.
? X
Sort

MMy data has headers


"Ad teet ttXDelete Levelsopy Level Option5.
Order
Column Sort On Marks Out of 100
Sort by Name Values
Roll No Name Maths Science Computer Total
2
49 56 65 170
Bhavesh 183
Daisy 50 56 77
4
80 89 90 259
Fatima
76 90 80 246
1 Harleen
98 86 85 269
Cancel
5 Shiv
Name field
Fig. 2.11 Data sorted according to
Fig. 2.10 Sort dialog box
Sorting Numerical Value
To sort data using numerical value, let US USe the sample database as shown
in fiaure
To do so, follow these steps:
data.
1. Select the cell range A2:F7 to sort the
2. On the Data tob, click on the Sort button in the Sort &Filter group (Fig. 2.9).
3. The Sort dialog box appears (Fig. 2.12).
Sort X

Add Level Delete Level Copy level Options.. M My data has headers
Coumn Sort On Order
Sort by Total Values Largest to Smalet

Cancel

Fig. 2.12 Specifying conditions for sorting numeric value


Under the Column section, click on the Sort by drop-down arrow, and select the
Total field.
In the Sort On drop-down list,Values option is selected bydefault.
In the Order drop-down list, select the Largest to Smallest option.
Make sure that My data has headers checkbox is selected.

Ava's Cool Tip >>


In the Sort dialog box:
To remove the previous sorting condition, click on the Delete Level button.
To add a new level, click onthe Add Level button.

4. Click on OK. The sorted database appears (Fig. 2.13). You will observe that the dato
in Total field is sorted in descending order, i.e., from Largest to Smallest.
Notice, the text values in column B, i.e. Name, are no more arranged in
alphabetical order.

Marks Out of 100


Roll No Name Maths ScienceComputer Total
3 Shiv 98 86 85 269
3 Fatima 80 89 90 259
5 1 Harleen 76 90 80 246
6 2 Daisy 50 56 77 183
Bhavesh 49 56 65 170

Fig. 2.13 Data sorted according to Total field


Info Box >>»>
Sort A to Z: This option arranges and sorts the text value in
But when you select a column that contains numerical value, alphabetical order, i.e. A to L.
the A to Z option changes to
Smallest to Largest. This option sots numerical values in ascending orde.
Sort Z to A: This option arranges the text value in reverse alphgbetical order, i.e. Z to A. But,
selectinga column that contains numerical value, changes the Z to A option to Largest to
Smallest. This option sorts numerical values in descending order.

Multiple Columns Sorting


Sometimes, youwant to sort your data on the basis of more than one column. In such
case, you cansort data using multiple columns sorting. Remember, while performing multiple
columns sorting, there must be aduplicate entry in any of the columns based on which you
wish to perform sorting.
Example: Your school has organized an inter school sports tournament. Your teacher asks you
to collect the data of winners and sort the list on the basis of Sport and Position fields.
To sort the data on the basis of multiple columns (Sport and Position), follow these steps:
1. Open a new worksheet and type the data (Fig. 2.14).
2. Select the range A2:D11.
3. Go tothe Data tab. Click on the Sort button in the Sort & Filter group.
4. The Sort dialog box appears (Fig. 2.15).
B D

Sort ?
1 Interschool Sports Tournament
School X
Delete Level V My data has headers
2 Sport Position Winner AL Add Level E Copy Level Options..

3 Skating 3 Neha DPS Column Sort On Order

4 Badminton 2 Aditi DAV Sort by Sport |Values A to Z

5 Chess 3 Varun KV Then by Position Values Snallest to largest


6 Chess 2 Vasu DPS
7 Skating 1 Rajdeep DAV
8 Badminton 1 Farhan KV
9 Chess 1 Dolma DAV
10Badminton 3 Harleen KV OK Cancei
11 Skating Megha DPS

Fig. 2.14 Sample database for mutiple columns sorting Fig. 2.15 Specifying conditions for multiple sorting

Under the Column section, click on the Sort by drop-down arrow. Selec the
Sport option in the list.
In the Sort On section, Values option is selected by default.
selected,
In the Order section, make sure that A to Z is selected. If it is not
27
then select it.
below the tirst one
Click on the Add Level button. A new criteria row appears
(Fig. 2.15).
Under the Column section, in the BC
Then by field, select the Position 1
Interschool Sports Tournament
2 Sport PositionWinner
option.
In the Order section, select the
3 Badminton
4 Badminton
Farhan
Aditi
School
KV
5 Badminton m
Harleen
DAV
Smallest to Largest option. 6Chess
KV
1 Dolma
Click on OK. Observe, the data DAV
7Chess 2 Vasu DPS
of Sport column will be arranged 8Chess 3 Varun KV
9 Skating 1
Rajdeep DAV
in alphabetical order, and the data 10 Skating Megha |DPS
of Position column will be arranged 11 Skating 3 Neha DPS

in ascending order (Fig. 2.16). Fig. 2.16 Data sorted according to multiple columns

FILTERING DATA
MS Excel lets you display the records which meet certain criteria and conditions specified
by you. Ittermporarily blocks or hides the unwanted data from being viewed. This feature is
called Filtering. MS Excel provides two Filter commands:
Filter: lt is used for simple criteria.
Advanced: It is used for specifying complex criteria.
To apply simple criteria to filter data, follow these steps:
1. Create a database (Fig, 2.17) and select any cell within the range Al:F6.
2. Click on the Data tab.
3. Click on the Filter button in the Sort & Filter group. Notice, small drop-down arrows
appear at the bottom right of each column header indicating that 'Filtering' feature is
enabled (Fig. 2.17). Each arrow contains conditions to fiter the selected field.
File Home Insert Page Layout Formulas Data Review Vieu 9 Tell me vhat you want to do.
hFrorm Access ShowQueries I Connections 1 Z4Ciet
FromWeb From Tabie BPropert1s Resouy
From Other Existing Ne
bFrom Tet Query LoRecent Sources
Refresh | Sort e Advanced Calumns
Sources Connections Al. dit Links
Get External Data Get & Transform Connetions Sort & Filter

A Roll No

A B D E
Roll No Name Maths Science.Computer. Total
2 1 Harleen 76 90 80 246
3 2 |Daisy 50 56 77 183
4 3 Fatima 80 89 90 259
5 Bhavesh 49 56 65 170
6 5 Shiv 98 86 85 269

Fig. 2.17 Sample database for filtering


4. Click on the drop-down arrow next to the Name column, i.e. B1. Adrop-down menu
appears (Fig. 2.18).
28
5. The Select Allcheckbox is selected by default. First of all, clear the Select All checkbox.
A Now, select Bhavesh and Fatima checkboxes in the menu.
7. Click on OK (Fig. 2.19).
A osB A B
1 Roll No Name
01 Sort Ato Z 1 Roll No Name
2 ! Spt Zto A 91 Sart Ato Z
Sort by Color 2 ! Sgrt Zto A
3 Sort by Color
3 Liear FitecF1or tianie

Tet Fiters
4 Tet Filters
Search
5 Selet AIn Search
DBhavesh 5
6 Daisy Bhavesh
Fatima
Harleen 6 Dovy..
Fatima

7 Shiw Haieen

7 UShiv

8 8
Cancel
Cancel

Fig. 2.18 Name column Filter drop-down list Fig. 2.19 Applying Filter
Excel filters the list and displays only the records that met the specified condition, i.e.
the records related to Bhavesh and Fatima (Fig. 2.20).

A
Roll No
B
Name Maths Science
E F
Computer. Total
Ava's Cool Tip »»>
Row number Fatima 80 89 90 259 Youcan access the Sort & Filter
turned blue 5 Bhavesh 49 56 65 170 button from the Editing group of
Fig. 2.20 Filtered result the Home tab.

Info Box »>>»


There are certain clues which determine whether a filter is applied to the range or not.
They are as follows:
The row numbers of filtered data are indicated by blue color.
The drop-down arrow of filtered column changes to Filter button T

Removing Filter
To remove the filter, follow these steps:
On the Data tab, click either on the Clear button Clear or Filter button Filter
in the
Sort & Filter group.
OR
Click on the Filter button next to the Name field (the filtered field) in figure 2.20. Select 29
eiher the Clear Filter From "Name" option or tick the Select All checkbox in the
drop-down menu.
Custom Filtering
The Custom Filter feature is used to
quickly filter data based on certain conditions.
you wantto display the records where Total marks are 'greater than or equal to 200, but
Custom Filter feature
Suppose, M
'less than or equal to 300'. In such a situation, you can use the to

To apply custom filter, follow these steps: to

1. Create a database (Fig. 2.21) and assume that filter is applied to the range A1:F&
fe
B C D E
er
1 Roll No Name Maths ScienceComputer. Total
90 80 246
fo
2 1 Harleen 76
50 56 77 183 to
3 2 Daisy
4 3 Fatima 80 89 90 259
5 Bhavesh 49 56 65 170
6 5 Shiv 98 86 85 269
To
Fig. 2.21 Sample database for custom filtering

2. Click on the drop-down arrow of Total field, i.e., F1.


3. In the drop-down menu, go to the
E F G
Number Filters option.
Computer. Total
4. Select the Custom Filter option (Fig. 2.22). 91
!
Sort Smallest to Largest
Sort Larqest to Smallest
5. The Custom AutoFilter dialog box appears Sort by Color
Cies Fite Fromcta
(Fig. 2.23). Number Flters Equals.

6. To display only those records where data is in Search


Select Al)
Does Not Equal.
Greater Than.

the range of '200 to 300', specity the criteria -46


170
183
Greater Than Qr Equal To
Less Than.
259
as shown in figure 2.23. Ensure that the 269
Less Than Or Egual To.
Beteeen..

And radio button is selected. Iop 10.


Above Average

7. Click on OK. Cancel


Belgw Average
Custorn Filter.

Excel displays only those records that satisfy the Fig. 2.22 Selecting the Custom Filter option
specified condition (Fig. 2.24).
Custom AutoFilter
X
Show rows where:
Total

is greater than or equal to 200


O And O or
is less than or equal to
v300 A B D E
1 Roll No Name Maths
Use ? to represent any single charater Science Computer. Total
Use to represent any series of characters 2 1 Harleen 76 90 246
80
3
30 Cancel
6 5
Fatima 80 89 90 259
Shiv 98 86 85 269
Fig. 2.23 The Custom AutoFilter dialog box
Fig. 2.24 Filtered result
DATA VALIDATION
A B C D E
MSExcel allows you to set certain rules 1
Students' Detal
2 Roll No
to restrict the type of data or values 1
Name Age Activity Hobby
|Armaan 12 |Vocal Music
to be entered in a cell. This can be 2 Chetan 11 |Dance
achieved through Data Validation 3 David 12 Chess
6
feature. It is used to ensure that the data 4 Farah 12 Cricket
7 5
entered in the field is accurate. lt checks Harpreet 11
Skating
8 6 |Jasleen 11 Vocal Music
for the validity of data. Let us learn how 7 Mahesh 11 Fine Art
to use the 'Data Validation' feature. Fig. 2.25 Selecting a range for Data Validation
Suppose, you have added a new 'Field' or 'Column', say, Hobby in the sample
database
(Fig. 2.25).
To apply data validation (set a rule to restrict the data entry) in the
field-Hobby, follow
these steps:
1. Select the range E3:E9 (Fig. 2.25).
2. Click on the Data tab.
3. Go to the Data Validation drop-down arrow in the Data Tools group.
4. Select the Data Validation option (Fig. 2.26).
Data Review View O Tell me what you want to do...
ons Clear Flash Fill Consc

Filter
Reapply Remove Duplicates Relati
| Sort Text to
Advanced Columns Data ValidationMana
Sort & Filter
Data Validation..
Circle Invalid Data
Clear Validation Circles

Fig. 2.26 Selecting the Data Validation option

5. The Data Validation dialog box appears (Fig. 2.27). By default, the Settings tab is
selected. Define the following:
Click on the Allow drop-down arrow and Data Validation ?

select the Text length option. (By default, Settings Input Message

Validation criteria
Error Alert

the Any Value option is selected.) Allow:


|Text length ignore blank
In the Data drop-down list, between Data:
between

option is the default value. Minimum:

In the Minimum and Maximum text Maximum:


1d
boxes, type 5 and 10, respectively. Apply these changes to all other cellis with the same settings
3
6. Select the Input Message tab (Fig. 2.28). Clear All Cancel

Define the following: Fig. 2.27 Defining validation criteria for fields
Valid data.
Inthe Title text box, type
between 5 and 10.
In the Input message box, type enter
the following:
7. Click on the Error Alert tab (Fig. 2.29). Define
In the Style drop-down menu, select the Warning option.
In the Title text box, type Invalid data.
In the Error message box, type Incorrect input. Click on OK.
Data Validation X Data Validation
?

Settings Input Message Error Alert Settings Input Message Error Alert
Show input message when cell is selected
MShow error alert after invalid data is entered
When cell is seleted, show this input message: When user enters invalid data, show this
error alert:
Iitke: Style:
Valid data
Iitle:
Warning Invalid data
Input message:
enter between 5 and 10 Error message:
Incorret input

Clear All OK Cancel Clear All


OK Cancel
Fig. 2.28 Defining an input message for fields
Fig. 2.29 Defining an error message for
fields
Youwill notice that the input message
appears in the selected range (Fig. 2.30). Now, if the
data entered in the selected cell range does
not meet the
"Invalid data' warning box (Fig. 2.31). Click on No to specified criteria, Excel prompts an
change the value in the cell.
A B C D
Students' Detail
2 Roll No Name Age Activity Hobby
3 1 Armaan 12 Vocal Music
4 2 Chetan 11 Dance Valid data
5 3 enter between
David 12 Chess 5and 10
6 Farah 12 |Cricket
7 5
6
Harpreet 11 Skating
|Jasleen 11 Vocal Music
9 7 Mahesh 11 Fine Art

Fig. 2.30 Displaying the input message

Invalid data X

Incorret input
Continue?
2 Yes No Cancel Help
Fig. 2.31 Warning message
Flashback

Database is an organized collection of information.


The structure of database is made up of fields and records.
Field is a column that contains only one type of data. For example, Roll No, Name, and so on.
Record appears as a row in a database. lIt is composed of two or more fields.
Aform is a small screen that contains the fields of a database along with the space to add,
modify, or view a record.
Filtering feature temporarily hides unwanted data from being viewed.
Custom filtering is Used to quickly filter data based on certain conditions.
entered
Data Validation allows you to set certain rules to restrict the type of data or values to be
in acell.

Exercises
A. Tick (/) the correct answers.
1. This is an organized collection of information.
a. Database b Chart C. Sorting
database along with the space to add,
2 It is a small screen that contains the fields of a
modify, or view a record.
b Form C. Frame
a. Worksheet

3. This is used to rearrange data in a specific order. Data Validation


b. Filtering C
a. Sorting
record by entering data in a
4. This button in the Sheet1 dialog box lets you search a
uniquely identified field.
C. Criteria
a. Find Prev b New
person, item, or an organization in a database.
5. It contains data and information about one
b. Field C Field Name
a. Record

B. Fill in the blanks.


at a time.
1. The feature lets you work on an individual record
the type of
2. The feature allows you to set certain rules to restrict
data or values to be entered in a cell.
in alphabetical order.
3. The option arranges and sorts the text value 33
remove the filter.
4. Click on the
button present on the Data tab to

5 A appearS as a row in a database.


C. Write T for True and F for False.
1. Field is a column that contains only one type of data.
2 The Remove Duplicates button is used to remove any unwanted
duplicate value from the range.
3. The structure of database is made up of boxes and shapes.
4 Field name is arow label in a database.
5. The Sort & Filter button is present in the Editing group of the Home tab.
D. Answer the following questions.
1. Explain the terms Field, Record, and Field name.

2. Describe the Form feature of Excel.

3. Differentiate between sorting and filtering data.

4. Explain Custom Filtering.

5. Describe the Data Validation feature.

34

You might also like