67% found this document useful (3 votes)
12K views287 pages

6 - Computer Systems and Applications (T.Y.B.com Sem - Vi)

Uploaded by

Shruti Mohanraj
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
67% found this document useful (3 votes)
12K views287 pages

6 - Computer Systems and Applications (T.Y.B.com Sem - Vi)

Uploaded by

Shruti Mohanraj
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/ 287

6heth Dublishers Drivalo limited

Our foot lbints


Rcgd. Offlce & Unit No. 4, Ground Floor, Lalwani Indushial Estate,
Show Room 14, G.D. Ambekar Marg, Wadala, Mumbai - 400 031.
(o (022) 6662 4553 I 66624554 FAX : 6662 4556
Email : [email protected]
Goa 'PALLAV-KUNJ', Borda, Margao, Goa, @ (0832)2733435
Pune 302, Mahalaxmi Chambers, 3d Floor, Appa Balwant Chowk,
(O (O20\ 2M50773
23, Budhwar Peth, Pune-411 002.
Nagpur ShreeniwasApt., Mukundraj Lane, Opp. Dharampeth Mahila Bank,
Walker Road, Mahal, Nagpur - 44O 0O2.

@ (0712)2737052
Vadodara Joshi Brother's ltishna lftupa Miradatar's Tekro,
Navabazar, Vadodara - 390001 (Gujarat). O O265-241897L I 2417287
Bhaunagar Shah & Co. High Court Road, Bharmagar (Gujarat). @ (0278\ 2576679

rsBN - 978-81-936595-5-7

@ Authors

The book is strictly written according to the new syllabus available u the time of pinting.
Every possible effort has been made to avoid enors and omissions in this publication by the Authors and the
Publishers. Inspite of this effort, some typographical errors might hove crept in. Any mistake, error or discrepancy
noted may be brought to our notice which shall be takcn care of in the forthcoming edition. It is hereby notified that
neither the Author nor thc Publishers or seller will be liable for any damage or loss to anyone, in any maruwr,
there Jrom. It is suggested that to avoid any doubt the reader should cross--check all the facts, law and contents of
the publication with original Government publication or notifications wherever applicable.
The text of this publication, or any part thereof, may not be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, storage in an infonnation retieval system, or
reproduced on any disc, tape, perforated media or other information storage device, etc., otherwise, without the
prior written permission of the publisher and author. No key to this book can be prepared without the prior written
permission of the Publishers. Any violation will invite prosecution legal action under the Indian Copyright Act.
This book is soW subject to the condition that it shall not by way of tradc or otherwise, be lent, resold, hired
out or circulated.
For binding mistakes, misprints or for misstng pages, etc., the publishers' liability is limited to replacement
within one month ofpurchase by similar edition. All expenses in this connecrton are to be borne by the purchaser.
All disputes are subject to jurisdiction of courts, tribunals andforums at Mumbai only.

Published & : 6heth Dubliohero Private [1d., Unit No. 4, Ground Floor,
Printed by Lalwani Industial Estate, 14, G.D. Ambekar Marg, Wadala, Mumbai - 400 031.
@ 6662 4553 I 6662 4554FAX:6662 4556.
Prcfacc

It
giues us great pleasure to present this book on the reuised sgllabus of
'computer Systems and Applications'for the students of T.Y.B.com. (Semester w)
This book is a result of a demand from th.e facultg teaching this subject as one
of us ha.s been inuolued not onlg in th.e framing of this reuised sgllabus, but also in
tle conduct of seueral utorkshops for th.e same.
An attempt hrs been made to include a large number of examples keeping in
mind the pattern of the qtestion papen Simple language h.as been used to make the
concepts uery clear.
"We ttaue also couered all the practical's in Visual Basic and Microsofi Excel, as
prescribed bg the Uniuersitg and giuen more exercises for practice".
We are thankful to Shri. Deepak Sheth, Shri. Kirit Sheth and the staff of
M/ s. Sheth Pubtishers Put. Ltd. for their sincere efforts in bringing out this book.

We hope that the students and the faaitg find this book useful. We would
appreciate constructiue suggestions uhich can be sent to [email protected] and
muke s h. te kut ani@ mail. co m

Although all care has been taken in the production of this book, a feut errors
maA haue inaduertentlg remained and the errata for this book and some
supplementary mateial for this book uill be auailable on the utebsite
wu)u).mA examnote s. com/ tgbcom. html

Fa;lyol @adlwalla
Mukcth N, Tokwanl

(iii)
Syllabas

Eleeti-os-eqryFes$C)
abAfiyfuhqaee rueLt C o ur s- e s_ ($E Q )

Modules at a Glance

Sr. Modules No. of


No. Lectures

1. E - Commerce 18

2. Advanced Spread Sheet 09

3. Advanced Spread Sheet 09

4. Visual Basic 09

Total 45

(v)
St.
Modules / Units
No.

1 E - Commerce
a) Definition of E-commerce
b) Feafures of E-commerce
c) Types of E-commerce (B2C B2B, C}C,P2P)
d) Business Models in E-commerce (Advertising, Subscriptiory
Transaction Fee, Sales Revenue, Affiliate Revenue)
e) Major B2C models (Portal, Etailer, Content Provider, Transaction
Broker, Market Creator, Service Provider, Community Provider).
0 E-Commerce Security: Integrity, Non repudiation, Authenticity,
Confidentiality, Privary Availability.
g) Encryption: Definition, Digital Signatures, SSL.
h) Payment Systems: Digital CastU Online stored value, Digital
accumulating balance payment, Digital credit accounts, digital
checking.
i) How an Online credit card transaction works. SET protocol.

i) Limitation of E-commerce.
k) M-commerce (Definition and Features).

2, Advanced Spread Sheet

a) Multiple Spread sheets


o Creating and using templates, Using predefined templates,
Adding protection option.
a Creating and Linking Multiple Spreadsheets.

a Using formulas and logical operators.

o Creating and using named ranges.

o Creating Formulas that use reference to cells in different


worksheets.

b) Functions
o Database Functions LOOKUB VLOOKUP, HLOOKUP

o Conditional Logic functions IF, Nested IF, COUNTIF, SUMIF,


AVERAGEIF

o String functions LEFT, RIGHT, MID, LEN UPPE& LOWE&


PROPE& TRIM, FIXED
(vi)
3 Advanced Spread Sheet

,. Date functions TODAY NOW, DATE, TIME, DAy, MONTH,


YEA& WEEKDAY DAYS360
. Statistical Functions COUNTA, COUNTBLANK CORREL,
LARGE, SMALL

. Filter with customized condition.


. The Graphical representation of data Columry Line, Pie and Bar
charts.
Using Scenarios, creating and managing a scenario.
Using Goal Seek
Using Solver
Understanding Macros, Creating, Recording and Running Simple
Macros. Editing a Macro(concept ody)

Visual Basic
a) Introduction to Visual Basig Introduction Graphical User Interface
(GUr).

b) Programming Language (Procedural, Object Oriented, Event Driven)


' Writing VB Projects. The Visual Basic Environment.
c) Introduction to VB Controls.
d) Text boxes, Frames, Check boxes, Option buttory Designing the User
Interface, Default & Cancel property, tab order, Coding for controls
using Text, Captiory Value property and Set Focus method.
e) Variables, Constants, and Calculations.
0 Variable and Constant, Data Typ" (String, Integer, Currenry, Single,
Double Date), Naming rules/conventions, Constants (Named &
Intrinsic) Declaring variables, Val Functiory Arithmetic Operations,
Formatting Data.
g) Decision and Condition
h) Conditiory Comparing numeric variables and constants, Comparing
Strings, Comparing Text Property of text box, Compound Conditions
(And, Or, Not). If Statement, if then-else Statement, LCase and Ucase
(vii)

A
functiory Using If statements with Option Buttons & Check Boxes.
Msgbox (Message box) statement Input Validation : Is Numeric
function.
i) Sub-procedures and Sub-functions, Using common dialog box,
Creating a new sub-procedure, Writing a Function procedure. Simple
loops using For Next statements and Do while statement and display
output using MsgBox Statement.

Nofr';
a) Theory l3lectures per week.
b) Practicalbatch size 20-25,01 practical = 03 theory leitures per week.
c) 10 Practical's are to be completed in each semester.

Semester VI
Topic Number of Practical's

Presentation skills 01

Advanced Spread Sheet 05

Introduction to Visual Basic 03

Minimum 5 practical's are to be recorded in the journal in the Semester VI


[Minimum 4 on VB, 2 on Advanced Spread Sheet)

Suggested list of Prat,tir'.:l's t'<:r 5,:rrr*ql.:r.\'i


1. Preparing a PowerPoint presentation on an E-Commerce website.
2. Calculation of DA, HRA, PF, Gross Salary and Net Salary using Spread Sheet.
3. Calculation of Income Tax using Spread Sheet.
4. Filtering data and Graphical representation of data using Spread Sheet.
5. Using VLOOKUP and HLOOKUP using Spread Sheet.
6. Creating and managing a scenario using Spread Sheet.
7. Use of Goal Seek and Solver using Spread Sheet.

8. Write a project in VB to design a suitable form to add two numbers and


display their sum.

(viii)
9. Write a project in VB to design a suitable form to enter sales and calculate and
display the bonus which is10% of sales.
L0. Write a project in VB to design a suitable form to enter salary and calculate
and display the DA which is90% of salary.

Scheme of Examination

TyPe Marks Duration


Theory 75 Zlh.hours

Practical 20 L hour per batch of L0

Active Participation and Class 05


conduct

Theory Examination Pattern


All questions .ue compulsory

Question Unit No. Marks Marks with


No. Internal Option

Q. 1. Objective type based on L (ILIII) and 11,+2+2 23


IV

Q.2. I 15 30

Q.3. II 15 30

Q.4. UI 15 30

Q. s. IV 15 30

Practical Examination Pattern- Semester VI

Sr. No. Topic Marks

01 Advanced Spread sheet 07

02 Introduction to VB Programing 03

03 Journal 05

04 Viva 05

(ix)

\
Practical examination to be conducted 2 to 3 weeks before the theory
examination. Marks out of 25 to be submitted to the University before
commencement of theory examination.
Software Requirement :

Spread Sheet 2010, VB 6.0


Hardware
For a batch of L20 students minimum 10 computers with appropriate
hardware and software installed on each computer. During practical hours
maximum two student may share one computer.
For in house computing facility fee of rupees 7501 - be charged for each
student per Semester in the existing fee structure against head of computer
fee / computer practical.

(x)
Contcnts

MODUTE I I E.COMMERCE
1. E-Commerce 1-6
2. 'Ilpes of E-Commerce andBusiness Models 7-13
3. E-Commerce Securit5r t4-24

MODULE II : ADVATYCED MS,EXCEL


4. Microsoft Excel - Multiple Spreadsheets 25-37
5. Microsoft Excel - Functions 38-54

UODULE III ; ADVAITCDD MS-EXCEL


6. Advanced Microsoft Excel - Functions 55-60
7. Microsoft Excel Data Analysis 61-91

. MODULE IV : VITUAL BASIC


8. Introduction to Visual Basic 92-tO4
9. Variables, Constants and Calculatigns 105-120

10. Decisions and Conditions 12t-t34


11. Introduction to Visual Basic Controls 135-150

12. Advanced Features of Visual Basic 151-171

13. Visual Basic Loops L72-r80

Practicals t8l-244
Viva 245-254

Model Paper 255-258

Mumbai University Question Paper (Sem.-VI) (Oct, 2O16)' 259-262

Mumbai University Question Paper (Sem.-V! (April, 2OL7l 263-266

Mumbai University Question Paper (Sem.-V! (Dec., 20771 267 - 270

Mumbai University Question Paper (Sem.-V! (March, 2018) 27L - 274

(xi)

b
ALL OUR BOOKS AVAILABLE AT
BOOKSTORE CONTACT BOOKSTORE CONTACT
NO. NO.
Lakhani Book Depot, Charni Road. 238543s6 Prabhat Stores, Kurla. 25227693
Students'Book Depot, Chami Road. 23853708 Jayesh Book Centre, Chembur (E). 25285416
Vidyarthi Book Depot Charni Road. 23858828 Nandu Book Cenfre, Chembur. 252t1441
Winner Book Depot Chowpatty. 23641307 Social Book Centre, Vidyavihar (E). 21027362
Mazgaon Book Depol Mazgaon. 23722081 Varsha Book Centre, Vidyavihar 32612537
Navjivan Book Cenhe, Bandra (W). 2il22157 Shah Book Depot Ghatkopar (W). 25156319
Goklesh Book Centre, Khar Road (W). 2il98981 Lata Book Depot, Vikhroli. 25749289
Parle Book Centre, Vile Parle (W). 26188389 Raj Book Depot, Bhandup. 259495t1
Vijay Book Cenhe, Vile Parle (W). 992090667t Jagdish Book Depot, Mulund (W). 9867281381
2610 t743
Parle Book Depot, Vile Parle (E). 26145984 Pooja Book Depot Mulund (W). 89704083 l0/
92244 98677
The Book Shop, Vile Parle (E). 26t82420t Sonal Book Depo! Mulund (E). 256422t0
2612 399r
Book Point Andheri (W). 9892106828 Jagdish Book Depot Thane (W). 98692127s9
Books Emporium, Andheri (E). 28203894 Laxmi Book Depot, Thane (W). 25367371
Santosh Book Depot Goregaon (W). 28766126 Saraswati Book Depot, Thane (W). 25367777
Thakur College Book Centre, 2885 1540 Bagade Stores, Kalyan (W). o25t-2204280
Kandivali (W).
Parshva Book Centre, Kandivali (W). 28076628 New Alankar Book Depot, Kalyan(W). 992055316t
Good Luck Stores, Mira Road. 9819816487 Hira Book Sellers, Ulhasnagar. 02st-2569521
Bhavik Book CenEe, Vasai Road (W). 02s0-2334280 Student Book Store, Vashi. 27662724
Ambika Book Cente, Vasai Road (W). 9270902323 Bhavesh Book Stall, Kopar Khairane. 27547616
Bhavik Book Depot Virar (W). 9270902323 Sai Book Depot, Airoli. 9769760CI97
Gandhi Stationery, Boisar (W). 02525-253935 Ganesh Book Depot Nerul. 27700531
Madhu Book Depot, Matunga (CR). 9324216999 Krishna Book Stores, Kharghar. 27744962
Shanti Book Store, Matunga (CR). . 24010275 Krishna Book Centre, Kharghar. 27749988
S.K. Book Stall, Sion (W). 240/.5605 Shree Narayan Stores, Panvel. 27454767
Navrang Books & General Stores, 8087983529/ Students' Agencies (D Pvt. LTE., 4M9 6t6U
Ambemath. 9764746986 Tardeo. 9167290777
GAJANAND Kmpa Enterprises, Vasai. 0250- Ambika Book Centre, Vasai. 0250 -2331365
2333s92t
9923669626
ANbHERI Book Depo! Andheri. 2683M32t Anjali Book Centre, Andheri. 26356618 /
28324126 28719025
Anjali Book Cenhe, Andheri. 263566181 College Book Cenfe, Vile Parle. 26707393
28719025
Maru Book Cenne, Kandivli. 28072124 Shree Ganesh Book Centre, Borivli. 28051251
Ambika Book Depot, Kandivli. 2846/073 Shanti Book Depot Bhayander. 2814713s
Shweta Book Depot, Kandivli. 9920998776 Shree Laxmi Stores, Bhayander. 9819260262
Milan Book Depot Vidyavihar. 9833 198030 Agrawal Book Depot Goregaon. 8760321
Bhavesh Stores, Borivli. 7710995974 New Jay Ambe Book D.pot, 0251 -24867251
Dombivli. 256173341
92233062s8
Kiran Stores, Silvassa. 9825545250 Jatin Traders, Nerul. 27726799
Shri Ganesh Book Depot, Nerul. 2770053u Ganesh Book Stores, Vashi. 276560841
27718627 27661809

Glory Book Cenhe, Nerul. 2772286 Prakash Novelty & Book Depot 27700859
Nerul.
College Book Centre, Kharghar. 99876447181
993076/.748
DCommerce t"r"l," 1

ODULE I
-COMMERC

I E-Commerce

INTRODUCTION
In the late 1970s, technologr such as Electronic Data Interchange (EDI) and
Electronic Funds Transfer (EFT) were used for doing commercial transactions
electronically. Now businesses could send commercial documents like purchase
orders or invoices electronically
The growth and acceptance of credit cards, automated teller machines (ATM)
and telephone banking in the 1980's was another form of Electronic Commerce.
In 199O, the World Wide Web was invented by Tim Berners-Lee. By the end of
2O0O many companies in America were offering their business services through
the internet.
Deflnltloa
/' of E-Commerce
I Electronic Commerce is a process of doing business electronically, using
infoYmation and communication technolory. Hence all digita[y enabled
commercial transactions between and among organizations and individuals is
covered under E-Commerce.
Simple examples of E-Commerce include buying and selling of 'various
products on the internet, such as movie and music CD's and DVD's, clothes,
books, software, cars, movie tickets, as well as making various reserwations in
airlines, railways, hotels etc.
There are many different delinitions of E-Commerce and each author has
defined it as perceived by him/her for its usefulness. However, the one given
above is the most popular among them.
FEATURES OF E.COMMERCE
The important features of E-Commerce as listed below :

Ilbtqutty
When we say that E-Commerce is ubiquitous, it means that it is available
just about ever5nnrhere and at any time. It removes tJ:e boundaries of space and
makes it possible to shop from the conflnes of your home or office and even when
travelling by various modes of transport. It removes several restrictions that are
normally associated with commerce, of having to spend time and money
travelling to the market place where you have to make your purchases. Hence it
liberates the market from any physical space that we normally associate with
carrying out commerce.
2 fc;f i CotryruterSystems andApplications-T.Y.B.Com.-(Sem.Vl)

Global Reach
E-Commerce technolosl pennits commercial transactions to cross various
cultural boundaries, as well as the geographical boundaries that have been made
by mankind across the globe. Hence the size of the market that is available for
E-Commerce includes the entire population which is going online. F\rrther with
more and more persons using computers and the internet, this number is going
to keep growing..The reach of tl:is market is globat and is continuously growing.
Universal Standards
The technical standards used in E-Commerce are universal standards
i.e. they are used all over the world. This is chiefly due to the fact that the
technical standards used in the internet are universal standards, which are
accepted and shared all over the world.
The use of these universal standards in E-Commerce has resulted in a great
reduction in the costs involved in searching for products, as tJrey can be viewed
by one and all. The suppliers of various products and their prices are located
easily without any technological barriers.
Interactlvity
The technologies used in E-Commerce are interactive i.e. they allow a two
way communication between the parties involved in the transaction, which are
the merchant making the sale and the buyer. For example, a website may ask the
consumer to fill in a form and depending on the data entered in that form,
various options are displayed, from which the consumer can choose the
appropriate one. Also online chatting has become a very popular means of such
communication which assist in E-Commerce. This two way communication is not
possible in various other technologies with the exception of the telephone.
Rlchness
Richness refers to the complexity and content of information on a product,
which is traded in E-Commerce. Using audio and video the richness of the
information that is given is greatly enhanced. This, in turn, becomes a powerfrrl
tool for selling in the commercial environment. Various products on display and
sale on the internet can be more effectively marketed, because of the richness of
the content of the website where this information is available.
Informatlon Denslt5r
Information density refers to the total amount and quality of information that
is available to all the stakeholders (market participants, consumers and
merchants). The wide use of E-Commerce has greatly reduced the cost of
collection of information, its storage, processing and communication. Further the
information available is more accurate as it is updated regularly. Today
information available is of better quality and is more plentiful.
Personallsation
This enables the merchants and traders to have better information of the
requirements in the market, due to which they can modi$ their marketing
strategies. Due to the interactive nature of technologr used in E-Commerce, the
past preferences and behaviour of the user is known. This enables merchants to
customize i.e. give the product or service as desired by the user.
This information also enables the merchants to divide the market into a
number of subgroups with a brand targeting each subgroup and charge premium
prices where high qualit5r of service is provided.
E-Commerce l,'lr't' 3

ELEMENTS OF E.COMMERCE
The elements mentioned below are normally present in any E-Commerce
transaction :

1. A product or service.
2. A website, which is the place where the business transaction takes place
and where the products and services being offered are displayed.
3. Means for visiting the website i.e. through the internet.
4. Method of accepting the orders by filling of an online order form.
5. Payment methodologr, which can be using credit cards or online
payments through direct debit etc.
6. Delivery methods to send the product to the customer. Normally third
parties are also involved in ensuring timely delivery of the products. In
case of games and software direct download is also available.
7. Facility to handle goods which are rejected and returned by the customer.
8. Means for handling warrant5r claims.
9. A follow up mechanism as a customer service, which will take care of FAQ
etc.
SCOPE OF E.COMMERCE
The scope of E-Commerce is extremely wide as it encompasses the globe. It
involves the staff and management of an organization , the suppliers, the traders,
the distributors and the entire infrastructure maintaining and keeping the
website updated at all times. The three main areas of application of E-Commerce
are listed below :
1. Electroalc Markete
It is a virfual representation of tl'e physical markets. that we are used to
seeing around us. It uses information and communication technologr to
showcase the various products being sold before the customers. It is here that
trading is done on the internet.
2. Elcctronic Data Interchange : (EDI|
' Electronic Data Interchange is a computer to computer exchange of
structured information which is given in a standard format, which can be directly
received and processed on computers. Sales invoices, Sales orders, Bills of lading
and many other documents are directly sent from one entit5r's computer to
another. To make EDI work one needs communications soffware, translation
software and access to standards.
Working of EDI
EDI works on the basis of the following three steps :
1. The data to be sent directly to the computer of the trading partner is first
converted into a standard format (called mapping) using a translation
software. There are specific standards for invoices, purchase orders etc.
2. This standard format is then sent over communication lines to the trading
partner's computer. For this the communication software is used.
3. At the trading partner's end, the format is re-translated using the
translation software.
Advantages of EDI
1. Orders are received faster.
2. Faster response from the trader.
2/T.Y.B.Com - Com. Sys. & Appl. (Sem. - V!
4 Jr't'3|' Computer Syslems and Applications - T-Y.B.Com.-(Sem. VI)

3. Payments are received much earlier.


4. Reduction in order lead time.
5. Not Expensive.
3. Internet Commerce
E-Commerce is possible because of the commercial use of the internet as
millions of people around the globe can be easily reached through the internet.
Business is done as the goods and services are advertised through the internet.
E-COMMERCE and E-BUSINESS
While the terms E-Commerce and E-Business are used interchangeably they
are not the same and are actually distinct concepts.
In E-Commerce Information and Communication Technologr (ICT) are used
to do transactions between firms, organizations and businesses (B2B) on one
hand and between firms, organizations, businesses and consumers (B2C) on the
other. Also transactions are done between consumers with other consumers
(C2C) or peer to peer (P2P).
In E-Business on the other hand we use ICT to improve and enhance the
business. There are three business processes which an otganization may want to
enhance in E-Business.
1. Production Proceas : This includes ordering stocks, interfacing with
suppliers and making payments.
2. Customer Process : This includes promotional and marketing efforts
which are made, customer support services and processing orders.
3. Internal Management Procesi : This includes all employee related
services, which include recruiting and training and internal information
sharing Ermong the employees.
N)VANTAGES OF E.COMMERCE APPLICATION
1. Reduced cost to buyers.
2. Reduced errors as orders are processed electronically.
3. Reduced cost to the traders as the orders are obtained online.
4. Reduced time per transaction.
5. New markets are easily created even in remote areas.
6. Better quality achieved due to product standardization.
7. Optimization of resource utilization.
8. Lower inventory costs to the traders.
9. Lower advertising costs.
l0.Equal opportunity for big and small merchants.
LIMITATIONS OF E.COMMERCE.
Even though there are many advantages of using E-Commerce, there are still
some issues that have to be considered before one goes headlong into the
E-Commerce world.
1. Products Not Bought Onllne : There are some products that never lend
themselves to E-Commerce. For example, perishable foods and high value
items like jewellery or antiques. Also there are some products fike a sofa
set, which one would like to sit on and get a feel of the texture before
making a buy decision.
E-Commerce t"n'n' 5

2. Security : The main issue before the customers is regarding theft of their
credit card numbers. Due to this there is reluctance among many
customers to buy online.
3. System and Data Integrity : The protection of data and the integrity of
the system that handles this data is a matter of serious concern. There
are a number of viruses that are rampant today and new viruses are
being encountered on a regular basis. These viruses cause unnecessary
delays, storage problems and there is always the danger of hackers
corrupting data in the system.
4. Expenslve to Maintain A Scalable Webslte : When a merchant puts up
a website for E-Commerce, he has a basic notion of the number of
persons that will visit his website. If twenty thousand are expected to visit
the site and one lakh do so there will be degradation and slowdown and
hence loss of customers. To avoid this there *iii harr. to be a constant
review of the number of visitors to the website and up gradation will have
to be done where necessary. This takes some effort and involves a cost
that needs to be kept in mind.
5. Fulfillment Problems : During peak periods like Diwali or Christmas
there may be a larger number of orders placed than the merchants
system can handle. This causes delay in the shipping of goods to the
customers, leading to a host of cancellations of orders, as products that
were needed at a particular point of time would not have the same value if
delivered after the festival is over.
5. Corporate Vulnerability : As all details of the merchant, namely the
products that are being offered, their catalogues, as well as other
business offers would be easily available to competitors, the larger
merchants may force them to work with very low margins due to more
competitive pricing. This would drive away an alternative source of
purchase for a consumer.
7. Technological Limltations : Today in a developing societ5r not all
persons have access to the internet nor do they have credit cards to carry
out transactions. This creates limitations in the scope of E-Commerce.
oBJECTTVE QUESTTONS
I. Answer which of the following are true or false?
1. The scope of E-Commerce is local..
2. EDI requires a invoice
3. E-Commerce is available 24 x 7.
4. E-Commerce means buying and selling of products or services by business or
consumers over the internet.
5. Trade cycle in E-Commerce is the sarne as in traditional commerce.
6. EDI is a part of E-Commerce
7. E - Market is a subset of E-Commerce.
8. E-Commerce is global.
il. Multiple Choice Questions
Select the approprlate optlon from the followlng :
1. Buying and selling products on the internet is called
a) EDI b) E-Commerce
c) E- Business d) E market
2. EDI stands for
a) Electronic Data Information b) Electronic Data Interchange
c) Electronic Data Interface d) Electronic Data Inference.
6 t'r'g' Computer Systems andApplbatbns-T.Y.B.Com.-(Sem.Vl)

3. E-Commerce means
a) Buying and selling b) Buying and selling over the internet
c) Accounting on the internet d) None of these
4 A computer to computer exchange of business transactions is called
a) E-Commerce b) E -Business
c) EDI d) E - Market

|axswERsl
I. [True i 3,4,5,6,7,8]
False z 1,21
r. l(1 - b)l (2 - b)l (3 - b)l (4 - c)I

QUESTTONS
1. What is E-Commerce?
2. What are the advantages and limitations of E-Commerce?
3. What is the difference between E-Commerce and E-Business?
4. Mention the elements of E-Commerce.
5. What is the scope of E-Commerce?
6. Explain the term EDI.
7. What are the advantages of EDI?
8. What are the features of E-Commerce?

r?'r'
Tgpes of E-Commerce andBusiness Models g't,'t,'

2 Tyf es of E-Commerce and


Busine.rs Models

Traditional forms of commerce have been in existence for decades and will
continue to do so. However due to the various advantages of E-Commerce listed
in the previous chapter, the trend to use E-Commerce has been increasing and is
bound to continue to do so. There are different types of E-Commerce and this
distinction is by the nature of the relationship i.e. the parties involved in the
buying and selling. The types of E-Commerce are :
i) Business - to - Consumer (B2C)
ii) Business - to - Business (B2B)
iii) Consumer - to - Consumer (C2C), Peer - to - Peer (P2P)

BUSTNESS -TO- CONSUMER (B2Cl

This refers to the sale of products and services from a firm or company to the
consumer. It is one of the largest forms of E-Commerce. It covers businesses
which sell their products directly to the consumer over the internet.
The most common examples are shopping, entertainment, travel etc. The
more common B2C E-Commerce examples are various online retailing companies
such as Amazon.com, drugstore.com, Barnes and Noble, toysRus etc. It is
estimated that the world wide B2C E-Commerce revenues had crossed US $425
billion rrr2OO4.
The general idea in B2C E-Commerce is to have access to more customers
and give them better services. This generates more sales and less expenditure is
incurred while doing so.
More and more persons are shifting to B2C E-Commerce, as instead of
rubbing shoulders with crowds at malls and supermarkets, one can visit the on-
line shopping malls from the comfort of your home and have the goods
conveniently delivered at your doorstep.
8 t't't,' Computer Sgstems and Applications - T.Y.B.Com.-(Sem. VI)

Soobr*- nsiE -
g r*iu I S $ :ueesa snc - ..] sd $re G"rlcry -
& - E - i.t di , p.e.. H.y- Id- O- "
,sclt@m 'g olm I mrw H,Goesl

fQdlff $OPnffC I tusm$&rc I $sstn i senup

Cto6e to &{ay or g/n *am cdt tagtzo af 1Q{,9r0 and mrc g$ducts - dalivery at yaut doorstsq'

Sbarch

goob mrG H&b Fddr Pofireas


k Massdcs JErcxery Houle Ptonos wffia9
Con${bc ffis llp3 Plilers wo#nTops vH{c&gk)

Baitdcrlrl234s5M*' Bnillt rmffi

REnt, rokl i
Psler
shin @40!6
C.:6ts
Rs.299
EnCdd Write

861 *[aqg
of

n Addrc
g9n
R+{95
8.8
Perfume Fd lllf,lliHl :'ry,Effib
1|l ,m
f[,w***,
U-rra.db.ck

e E,xrfgdFa*gdiue,dqui*dw.l

I'it
ffiH0ll
gotWqnqMh$M

sto[3
EWffi
gqslx..
YE-lldgil 5iiru stury.
$ cffiryh24mlb.Flre. ffi6,
CtrffistHmpG
Ik td
ABt{, Pffi Engae4
Eryl0nro Brnda ts Cl[slrtLeetups&mnrffie
S,at edADpaeb
Wls.
-

]NTffiWdOB,U,W rGwdi[ffioe.r4,rc y
WlMMQba,m u*!6rIEfrnrelEB.3,3B IIr d.y ry drfld .r.Xs fie @t h. !16l
On

fnli.. !h.Fpi|r 3l

TWo classiflcations of B2C E-Commerce are:


1. Diiect Sellers : They provide products and services directly to the
consumer. They are of two types :
al E-Tailers : They deliver the products directly to the consumer on
receiving the order. They are not the manufacturers of the product.
bl Maaufacturers : They sell their products directly to the customer.
2. Brokers : They are companies who facilitate transactions between buyers
and sellers and enjoy a certain percentage as commission. They can be
further classified in many types like Metamediary, Virtual mall, search
agent shopping facilitator etc. Another grouping similar to brokers is
called infomediaries who work on different models.
B2C offers several advantages over other forms of business like more
convenient shopping experience and more competitive prices as organizations
work with lower inventories.
BUSTNESS - TO - BUSTNESS (B2Bl
Business - to - Business (B2B) is the exchange of goods, services or
information on the internet between business enterprises. It is simply
E-Commerce between businesses.
About 80% of E-Commerce is of this type. One of the reasons for this is that
in B2B there are several transactions dealing with supply of material and
components, while there will be only one B2C transaction, where the final
product is delivered to the consumer.
Models
Tgpes of E-Comtnerce and Business t 't"j' 9

While B2C merchants se1l on a first-come, first-served basis, most B2B


commerce is done through negotiated contracts that allow the seller to anticipate
and plan for how much the buyer will purchase.
In some cases B2B is not so much a matter of generating revenue as it is a
matter of making connections with business partners. Godrej Company selling
soap to its distributors would be B2B while distributor selling to end customer
would be B2C. Examples of B2B websites are SeekandSource.com an online B2B
Marketplace and Indian Trade portal, Shop2gether.com which provides small-
business owners with an opportunity to use their collective buying power to
secure the preferred pricing offered to large corporations.
B2B uses UN/EDIFACT which is one of the most popular and established
standards in B2B E-Commerce. Another popular standard used is ANSI
ASC X12.
coNsuMER - TO - CONSUMER (C2Cl, PEER - TO - PEER lP]2pl
Consumer -to- Consumer E-Commerce allows consumers to sell to each
other with the help of electronic tools. C2C E-Commerce involves electronically
facilitated transactions between consumers with the help of a third party. An
example of this is online auctions which are very popular. One of the sites that
are used is ebay.com. The features of such a system are that the consumer
merely puts the product on auction on the site and waits for bids.'Normally the
auction is open till a specified day and time till which online bids are accepted by
the website. Thanks to online payment system like PayPal consumers can send
and receive money online with great ease.
Peer - To -Peer (P2Pl
Through P2P services, individuals can exchange online digital products as
they are put directly in contact with each other. Generally the users exchange
games and music tracks. Gnutella is a free open source software, that allows the
users to exchange music tracks with one another directly. BitTorrent.com is a
P2P site for unlimited music and videos. One of the main differences with C2C is
that one does not have to go through a central file server.
BUSINESS MODELS IN E.COMMERCE
A business modet is a set of processes that are designed to achieve some
planned objective and earn a profit for the business.
Revenue Model
The revenue model indicates how revenue will be earned by the business and
higher return on investments will be generated. The following are the major types
of revenue models :
1. Advertising Revenue Model
2. Subscription Revenue Mode1
3. Transaction Fee Reveilue Model
4. Sales Revenue Model
5. Affiliate Revenue Model
1. Advertislng Revenue Model
Just like in television shows or cricket matches the telecast is interrupted to
show advertisements, in this model websites which attract a lot of hits (number
of people who visit this website) offer advertisement space on their pages for a fee.
Such websites are widely sought after and earn high revenue from
advertisements. Most of these websites are offering users content, services
10 t"t'll' Computer Systems andApplications -T.Y.B.Com.-(Sem. VI)

arrd.f or products. Such websites are popular and hence become a good place for
any business to advertise their products and get noticed.
When the user clicks on the banner, the website of the sponsor of the
advertisement is displayed. Banner advertisement is most common and is used
by Yahoo.com, Rediff.com etc. to generate revenue for their business.
2. Subscription Revenue Model
In this model the Company charges the users a subscription fee for having
access to the material, offering it has on its website. Those who subscribe to this
website are given a username and password using which they can access the
website. Generally the subscription fee is valid for a certain period of time only.
The content of the websites that use this model
a) should not be available elsewhere for free.
b) must be a premium offering and should be perceived to be of high value.
A Company's website which offers daily tips to traders on the share market is
one example of such a model. Another example is Consumerreports.org which
charges a monthly subscription fee of $5.95 and a yearly fee of $26 to its
subscribers.
3. Transaction Fee Revenue Model
In the Transaction Fee Revenue Model, a company charges a fee for the
transaction it carries out. The fee amount depends on the number and size of the
transactions. An example of such a model is websites that allow online auction
facilities. Most of these websites charge a small fee when the item is sold. An
example of this is ebay.com.
4. Sales Revenue Model
In the Sales Revenue Model companies obtain revenue by selling various
products, information or services to its customers. Websites that market
products and build sales revenue from merchandising belong to this model. For
this the website has to build a brand of its own. An example of this is
Amazor..com which is one of the popular sites for purchasing books.
5. Affiliate Revenue Model
In the Affrliate Revenue Model companies send business to an affiliate and
receive a suitable fee which could be a flat fee, or even a percentage of the
revenue generated. They also earn revenue by offering incentives for the
transaction that take place. This is done by offering potential customers special
deals. When the customers take advantage of this and make any purchase, they
earn point which can be redeemed against various gift items. The company
benefits from the fee it receives for sending the business to the affiliate. An
example of this is mypoints.com
MA"TOR BUSINESS - TO - CONSUMER (B2Cl MODELS
The major B2C E-Commerce models used to generate revenue by doing
online transactions with consumers are listed below :
1. PORTAL
A Portal offers its users an integrated package of content and services, which
include news, events, e-mail, sports, shopping, video streaming etc. along with a
powerful search engine for searching the net. It becomes a starting point for most
users. Users are attracted to visit these portals and spend time looking up things
which interest them.
Many businesses place their advertisements on such portals, as they get a
ready audience for marketing the product/ service. They pay the Portals a fee for
Tgpes of E-Commerce and Business Models jl ;t'tt, 11

keeping the advertisement for a given period of time. The amount also depends
on the position where the advertisement is placed, with more prominent positions
being charged a higher fee. The revenue earned by Portals is mainly from
advertisements and referrals to other sites. The Portals themselves do not sell
anything.
2. E.TAILER
E-TAILER delivers the product direcfly to the consumer on receiving the
order. E-Tailer is not the manufacturer of the product and is nothing but an
online version of a retailer.
E-Tailer is of two types :
af Rrre plays : Their only means of retailing is the internet. They do not
have any physical store made of bricks and concrete. They can earn
higher profit margins as there are no high over\ead costs to take care of.
An example of this is amazon.com.
b) Brtcks and clicks : They have a physical store where they sell directly to
consumers who'walk in, and they also do retaitng on the internet. They
enjoy the benefit of both types of businesses. They can do better business
and earn higher returns.
3. CONTENT PROVIDER
Content Providers distribute various forms of information, such as news
items, artwork, videos, photographs, text etc.(Intellectual Property) on the web.
Content Providers charge a subscription fee for making these facilities available
to the user. These sites earn their revenue by charging a subscription fee which
can be monthly or yearly. Further specific downloads made are charged
depending on their content and size.
Major newspapers are available on the internet free for reading
e.g. timesofindia.com, expressindia.com, mid-day.conl etc. They allow you to read
most of the headlines, however for reading the full contents of the paper most of
them charge a subscription fee.
4. TRANSACTION BROKER
Transaction brokers charge a commission for facilitating transactions. They
bring the buyers and sellers together, so that a trade takes place. These
transactions could be financial, travel related, placements etc. The brokerage firm
eTrade has grown by going online, and it has lowered the commission charged to
the customer's. Transaction brokers earn more if they attract new customers or
the existing customer's trade more often. They provide opinions on various
financial matters and provide timely information. Job placement sites such as
naukri.com provide job openings all over India, hence are providing a national
marketplace.
5. MARKTT CRTATOR
Market Creator model uses internet technolory to build markets where
buyers and sellers can meet, decide on a product and fix the price for that
product. The web has made it possible to delink markets from physical space.
EBay.com is one such digital market place. There are no intermediaries, the
buyers and sellers have to decide on the transaction themselves as there are no
agents to represent them. EBay.com earns revenue by charging a fee to list the
product and also a fee on each sale. This may sound very lucrative, but the
digitaf market place has to attract many buyers and sellers otherwise the model
will not be feasible.
12 tt"tl't' Computer Systems andApplications-T.Y.B.Com.-(Sem. VI)

6. SERVICE PROVIDER
Service providers provide services ontne. The services that are provided by
them range from email, sharing videos and photos, and sharing various other
materials created by the user. These service providers trade their knowledge and
expertise for revenue. Hence even sites which promote social networking are also
covered under this model. Most Service providers earn their revenue by charging
for advertising space that they provide.
Google maps, orkut, and Gmail are examples of service providers.
1. COMMUNITY PROVIDER
Community providers are sites which create a digital online environment,
which enable people with similar interests to transact and communicate with like
minded people. They may also share photos and videos. They rely on hybrid
revenue models and earrt their revenue from subscription fees and advertising.

oBJECTTVE QUESTTONS
I. State which of the following is tnre or false :
1. B2B E-Commerce is between Business to Business and consumers.
2. ANSI ASC X12 is a popular standard used in B2B E-Commerce.
3. Brokers facilitate transactions in B2C between buyers and sellers.
4. E-tailers are not direct sellers.
5. In C2C E-Commerce consumers transact with other consumers through a physical
market.
6. In the subscription model a fee is charged to the user for having access to material
on the website.
7. Orkut is a type of service provider.
8. B2C E-Commerce is seller driven.
9. In e-auctions one of the greatest advantages is that there is physical inspection of
goods.
10. The volume of B2B transactions being done is more than B2C transactions.
11. Transaction brokers charge a fee for facilitating transactions.
12. There is no scope for negotiations in B2B E-Commerce.
13. There is no scope for negotiations in B2C E-Commerce.
14. More securitSz is required in B2C E-Commerce.
15. ebay.com is an example of Transaction Fee Revenue model.
L6. B2C refers to Business selling goods to other business.
17. E-tailer is a online retail shop.
18. In E-commerce Ubiquity refers to Universal Standards
L9. B2B refers to a Business selling goods to other individuals.
20. Portals are focused around a particular market segment.
21. Transaction Brokers make money each time a transaction occurs
22. ebay.com is an example of C2C E-Commerce.
23. Digital signature changes for every document.
U. Select the approprlate optlon from the followlag :
1. The fulI form of P2P in E-Commerce is :
a) Peer to Peer b) person to person
c) Peer to Person d) person to peer
2. The full form of B2B in E-Commerce is :
a) Bill to Bill b) Business to Business
c) Bill to Business d) Business to Bill
Tgpes of E-Commerce and Business Models n'n"n' 13

3. The full form of B2C in E-Commerce is :

a) Business to Care b) Business to Case


c) Business to Consumer d) Business to Core.
4. The full form of C2C in E-Commerce is :
a) Consumer to Commerce b) Commerce to Consumer
c) Consumer to Consumer d) Commerce to Commerce
5. The full form of HTTP in E-Commerce is Hyper Text Transfer :
a) Paper b) Protocol
c) Power d) Place
6. The full form of SET in E-Commerce is :
a) Secure Electronic Tax b) Secure Electronic Transaction
c) Secure Electronic Territory d) Secure Electronic Tunnel
7. The full form of SSL in E-Commerce is :
a) Secure Socket Layer b) Secure Socket Loop
c) Secure Socket Locket d) Secure Socket Liaison
8. The full form of WAP in E-Commerce is Wireless _ Protocol.
a) And b) App
c) Application d) Area
9. Generally most people are familiar with _ form of E-Commerce.
a) B2B b) c2B
c) B2c d) c2C
10. The maximum number of transactions done in E-Commerce are of _ type.
a) B2B b) C2B
c) B2c d) c2c
1 1. In _ E-Commerce the consumers deal with each other.
a) B2B b) c2B
c) c2C d) B2c
12. is part of E-Commerce.
a) B2B b) C2C
- B2C
c) d) All of these

lANswERsl
9. [True : 2, 3, 4,6, 8, lO, 11, 12, 13, 15, 17, 2l
False : 1, 5, 7,g, 14,16, 18, lg, 20,22, 23.1
10. [(1 -a)(2-b) (3-c) [(4-c) (s-b) (6-blV -a) (8-c) (e-c) (10-a) [(11-c) (12-d)]

QUESTIONS
1. State the various types of E-Commerce.
2. Explain B2C E-Commerce.
3. Explain C2C E-Commerce.
4. Explain what are the classifications of B2C E-Commerce.
5. Explain in brief the various business models in E-Commerce.
6. Gives the names of 5 B2C business models and explain any one.
7. Explain what an E-tailer is.
8. What are the different types of Revenue models in E-Commerce?

t'r"t'

\
14 t'll'l," Computer Sgstems and Applications - T.Y.B.Com.-(Sem. VI)

3 E-Commerce Security

One of the things that have slowed down the growth of E-Commerce is the
problems of security. Many of those who would like to use E-Commerce are afraid
about the theft of their credit card numbers. This is because the technologies
that form the basis of E-Commerce can be used to obtain confidential
information. Some of the issues of security in E-Commerce are discussed below :
1. INTEGRITY
Integrity refers to the ability to check and ensure that the data being
displayed on a web site or what data is sent over the internet has not been
changed in any way. This can be done if it is possible to authenticate and veri$r
who sent the information and from which computer and tJlat the information has
not been tampered \rith.
All those who want to use E-Commerce will be harboring suspicions on the
integrity of the system. Only those with the authority to access and alter the data
should be capable of doing so. If this power falls in the wrong hands, the threat to
the integrity of the system is very real and can be very dangerous. A digital
signature is normally used to ensure integrity of the message and this is
discussed later in this chapter.
2. ITON REPUDIATION
Non repudiation refers to the requirement that the parties who are doing
E-Commerce, narnely the buyer and the seller, do not deny that they have
initiated the transaction.
This means that the buyer should not deny placing the order and the seller
should not deny that the order has been received. The main worry for the
company doing E-Commerce is that the customer should not deny placing the
order, as this will mean the company loses money on freight and packing. For the
customer, the worry is of someone hacking into their account and placing an
order on their behalf, and using their credit card number. Thus non repudiation
is used to ensure that the buyer and the seller cannot deny that the transaction
has occurred.
3. AUTHENTICITY
Authenticity refers to the ability to determine the origin of the message
received over the internet. This refers to knowing the identity of the person who
has sent the message, from where the message was sent and the identity of the
computer used to send the message.
Proper identification is very important for both the parties dealing in
E-Commerce. It would help confirm whether the order received is genuine or not
and would eliminate the possibility of fraud.
4. CONFIDEI|TIALITY
Confidentialit5r ensures that the message and data are viewed only by the
person to whom they are sent and who has the authority to view them. These
concerns regarding access to data and privacy are meant to ensure that within
E-Comm.erce Securitg fI'll' 15
an orgatization no unauthorized person can lay their hands on such information.
It is well known that there is very sensitive data, such as credit card details,
which are sent as part of an E-Commerce transaction. It is important to ensure
that evrcn if the data is hacked into, it cannot be easily read. Normally to ensure
confidentiality data encq4ption is used, which is discussed later.
5. AVAILABILITY
Availability means that the E-Commerce systems are available continuously
at all times when needed. The customer must get a fully functional E-Commerce
site which works as it is intended to. It would be very irritating to the customer to
see that the site is down due to some problem, when a transaction has to be
urgently done.
As long as all the above mentioned dimensions are functioning as intended
there will be no securit5r issue in E-Commerce.
ENCRYPTION
Encq4ption is the method of protecting internet messages from being read by
anyone, while they are being sent between sender and receiver.
Encryption transforms messages and data to protect their meaning. The
message is so scrambled that it can be understood only by the person who knows
the method of encryption and holds the key to decipher the message. Hence
Encryption is the conversion of readable text into characters (cipher text) that
disguise the original meaning of the text.

Encryption using
Readable text Cipher text
encryption key

Decryptlon is the reverse process to Encryption. Here the Cipher text


message(a senseless character'string) is converted back into the original message
so that it can be read by the receiver.

Decryption using Readable text


Cipher Text
Decryption key

There are two primar5r forms of encryption systems, Private Key Encryption
and Public
Key Encryption.
PRI1IATE KEY ENCRYPTION
In Private Key encryption thesame key is used to encr5pt and decrypt a
message. A key is an Algorithm which is used to encode and decode a message.
Encryption can be done by substitutlon or transposltion. In substitution
method every alphabet is replaced by another alphabet. This becomes quite
predictable as a given input will always give after encryption the same resultant
output. In transposition the letters are re-arranged and are controlled by a key.
Hence this is a better method as compared with the substitution method.
Though Private Key encr5rption sounds very simple it has many problems. For
example, how do you distribute the key securely? One way is to send the key with
the message, however if the message is intercepted, then the key is also obtained
and it will be used to decipher the message. Other ways could be to send it by fax
16 ,"r"t" Computer Systems andApplicatians-T.Y.B.Com.-(Sem. VI)

or give it over the telephone. None of these methods is really secure. Also what is
the guarantee that the receiver of the key will protect its secrecy? The other
problem is that a separate private key will h"r" to be created for each
organization with which encrJapted messages are exchanged.
PUBLIC KEY ENCRYPTION
In Public Key Encryption there are two keys, one private and the other
public. The public key is freely given and is used to encr54pt the message received
by you. On the other hand the private key remains secret and is used to decrypt
message which have been encqpted with the private key by the sender.
Hence the public key is freely given to everyone who is going to send
messages. The message will be encr5pted with the public key by the sender. On
receiving the message the private key will be used to decrypt the messagc Hence
the private key, whick is the 6nly kev which can decrypt the message, remains
secure with the receiver.
Rrblic Key Encryption

Sender Encrypt Decrypt Receiver

Recelvers Public Key Receivers Hvate key


The public key encryption system removes the drawbacks of transmitting the
keys which are faced in Private Key Encryption system. The Public Keys are freely
exchanged and may also be available on the website. Public databases can exist
which contain the Public Keys of various organizalions. When there is a need to
send a message containing important data like credit card numbers, the Public
Key is downloaded from the internet and is used to encqrpt the message, which is
then sent to the receiver. However, only the receiver has the Private Key which is
used to open the message, hence no one else can have access to the details of the
message. This ensures that the transaction is secure.
However, there is another issue in Public Key Encryption, which is of
authentication. How can we be sure that the sender is really the sender and not
an imposter? What if someone else has sent the message using the sender's
name? This leads to situations where the sender will deny sending the message.
To overcome this drawback digital signatures are used.
Security experts believe that there is a graphical form of encryption which is
called Steganography. In this technique digitaf watermarking hides messages
within graphic files. It is rumored that terrorist organizations are using this
method.
DIGITAL SIGNATURES
A Digital Signature is a digital code that is attached to a message sent
electronically. This digital code uniquely identifies the sender of the message.
Digital Signatures are now very widely used as a means of authenticating the
sender of the message. This has become all the more necessary, as in today'
world with increasing number of intera,:tions between people using E-Commerce,
there is no face to face meeting of the sender and the receiver to confirm their
identities.
E-Commerce Securitg l''lr't' 17
Digital Signature with Rrblic Key System

Sender Sign Verify Receiver

Seader's Private Key Sender's Public Key

The method used in Digital Signature with Public Key System is as follows :
a) The sender encr5pts the message to be sent using the receiver's Public
key.
b) The sender then adds a Digital Signature to the message using his Private
Key, so that the sender's identity can be verified. .
c) The receiver of the message then verifies the identity of tJ:e sender of the
message using the sender's Public key.
d) The receiver of the message then uses his Private Key to decrypt the
message.
Digital Signatures have been made legally binding in some countries.
sEcuRE socKET LAYER{SSLI
Security of data in transit over the internet has become increasingly
necessary. Secure Socket Layer is a protocol developed by Netscape for securit5r of
data in transit, which covers all networks that use TCP/IP to support
communication between servers and clients. Both Netscape Navigator and
Internet Explorer support SSL and many of the websites use this protocol to
obtain credit card numbers over the internet. There is a convention that all sites
that use a SSL connection use HTTPS instead of HTTP.
SSL uses a program layer located between the Internet's H5rpertext Transfer
Protocol (HTTP) and Transport Control Protocol (TCP) layers. The SSL protocol is
used to give data encryption and authentication of the server. Browsers that use
SSL protocol show a dialog box on the screen to indicate that a secure session is
ongoing, while Netscape shows a blue key to indicate the same. SSL uses a
cryptographic system where two keys are used to encqpt the data, namely the
public key and the private key and also includes the use of the digital certificate.
SSL has recently been succeeded by Transport Layer Security (TLS) which is
based on SSL.
PAYMENT SYSTEMS
When comrnerce has become Electronic, the means of paying for goods and
services has also become electronic. The traditional paper based systems used for
making payments cannot give the speed, privacy and internationalization needed
in E-Commerce. The following payment systems are used in E-Commerce :
1. DIGITAL CASH
Digital Cash is the electronic parallel of notes and coins. It is a string of
numbers that represent an amount of money. The customer or consumer has to
deposit cash in the bank, in lieu of which, the bank will be give electronic
authenticated (digital) tokens. The customer can then use this to pay for what is
purchased electronically. The merchant who receives these electronic tokens then
deposits them in his bank and his bank credits his account.
18 t't "'" Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

2. ONLINE STORED VALUE SYSTEMS


Online stored value systems allow the customers to make immediate online
payments to merchants and others, based on the amount that they have kept in
their online account. Examples of this are debit cards, prepaid cards and smart
cards and PayPaI. The amount from the customers debit card is transferred as
per his instructions when a purchase is made, and the money is taken from the
bank account of that customer. Smart cards are similar to credit cards in size but
have a small chip on them in which information is recorded. Such cards are used
for making smdl payments. Another example is Pay Pal, where your account with
them is linked to your bank account. When a purchase is made and you pay
using PayPal, the money is taken from your account.
3. DIGITAL ACCUMULATING BALANCE PAY-UENT
They are accounts that permit users to make micro payments and purchases
on the web such as books, garnes, music, ring tones, online subscription to
magazines etc. For the debit balance tlat is accumulated, the customer is billed
at the end of the month. The customer is expected to clear the entire amount of
the debit either in cash, cheque or credit card.
4. DIGITAL CRTDIT CARD PAYMENTS
Digital credit card payments are focused on making the use of credit cards
safer and convenient for both the purchaser and the seller. It is the most widely
used method for paylng for an E-Commerce transaction. It is the easiest way for
payrng for goods and services on-line. A user enters his credit card number, his
narme and the expiry date of the card and the merchant validates this information
and upon approval from the credit card company, ships the goods to the user.
Hence this becomes an extension functionality of credit cards which are used for
payment of online shopping bills.
5. DIGITAL CHECKING
Digital checking payment systems extend the functionality of existing
checking accounts as online shopping payment tools. They can be thought of an
extension of normal banking tools. The advantage of such an account is that the
individuals need not reveal the details of their account to the vendor, as a digital
cheque which is produced after verification is sent to the vendor. Cheques are
signed using digitaf signatures and digital certificates are used for authentication
of the customer and their bank account details. The method is not very popular
as compared to other pa5rment methods.
HOW AN ONLINE CREDIT CARD TRANSACTION WORKS
It is but natural that a majority of online transactions are done using credit
cards. It has been the most popular pa5rment method for several years. Let us see
what is involved in making a purchase online.
1. Select the items on the merchant's website which need to be purchased.
2. Enter a credit card number into the merchant's website payment form.
3. Receive an acknowledgement number from the merchant's website as a
proof of the transaction.
4. Wait for the goods to be shipped to us.
It's as simple as thatl However, what happens behind the scenes is worth
exploring.
The online credit card transaction can be said to consist of three major
parts :
(a) A-uthorization, (b) Request for F\rnds, (c) Funds transfer
DCommerce Seatritg t?'t ' 19
The entities involved in this process are the Consumer, Merchant,
Consumer's bank, Merchant's bank and the clearing house. The detailed
procedure is given in Fig. 3.1.

+-> <-|>
Internet

Customer Merchant

00
llFIl
!r rr
ht

Merchants Bank

Customers Credit
Card Issuing Bank

Credit Card Network


Ftg.3.1
1. The customer goes to the merchant's website, selects the products to be
purchased, by adding them to a shopping cart and then clicks on the
button ?roceed to checkout'. A secure and encrypted form opens on the
web browser which is,indicated on the screen, by a sign at the bottom.
2. The customer enters in this form his narne, address, credit card details
i.e. Visa or MasterCard etc. the credit card number and expiration date
etc., then clicks on the submit button.
3. A secure tunnel is created through the internet using SSL for sending this
card information and the payment application encr5pts and transmits the
credit card information to the merchant.
4. The merchant sends this credit card information to a clearing house,
which is a financial intermediary, which verifies card details and checks
whether there is suflicient credit available for making the purchase. If
there is insufficient balance on the card, a message declining the
transaction is generated.
3/T.Y.B.Com - Com. Sys. & Appl. (Sem. - VI)
20 t?'t' - T.Y.B.Com.-(Sem. Vl
Computer Sgstems and Apptications

5. The clearing house sends the information over the appropriate credit card
network to the customers issuing bank for verification and payment. The
customers issuing bank generates a confirmation number which is sent to
the merchant via the clearing house.
6. The merchant sends this confirmation number along with purchase order
details to the customer and requests the customer to take a print out of
this information for the customer's record. The merchant then proceeds to
shipping the order.
7. At the end of the day the customer's issuing bank sends the amount of
the transabtion to the clearing house. The clearing house credits the
merchant's bank with the amount and keeps a small percentage as
processing fee. The customer's issuing bank sends a monthly statement
to the customer for pa5rment which contains the details of purchases
made during that nionth.
LIMITATIONS OF ONLINE CREDIT CARD PAYMENT SYSTEMS
1. Processing fees r The merchant has to pay the clearing house, a certain
transaction fee for processing the order.
2. Security : As the buyer and seller never get to meet or see each other in
this form of commerce, neither of them are fully authenticated. The
merchant cannot tell if the credit card is in the hand of one's spouse, a
thief or a 13 year old child.
3. Availabillty : There are many consumers who do not possess a credit
card, hence this entire segment of the market is not available for E-
Commerce using credit cards.
sEcuRE ELECTRONTC TRANSACTTONS(SETI
A secure electronic transaction (SET) is a protocol jointly developed by a
consortium consisting of Visa and MasterCard and is jointly administered by
them. It is one of the standards for handling transactions on the internet. It
ensures secure and reliable transaction processing in E-Commerce. The main
features of SET protocol are as follows :
a In a SET protocol all the sensltive information sent between the customer,
the merchant and the merchant's bank is encrypted.
o All the above three parties have to get themselves authenticated by the
SET certificate authority.
o The customer's credit card number is never seen by the merchant.
SET covers all the aspects of online commerce. It authenticates the
identification of the parties involved in the transaction by using a combination of
cr54ptography systems along with digitaf certificates. SET was developed to
ensure.
a) Confidentiality of payment.
b) Integrity of transmitted data.
c) Authentication of the cardholder as well as the merchant's ability to
receive payment by a credit card, and
d) Interoperability across network providers.
The protocol defined by SET is quite complex and hence
it is not economical
for small payments. To implement SET its software such as SET "electronic
wallet" must be installed in the client's Web Browser. It is a big chatlenge to make
such software widely available.
E-Commerce Seanritg t"t?' 21

MOBILE COMMERCE (M-Commercef


Mobile Commerce commonly called m-commerce, means buying and selling
of goods and services through wireless handheld devices such as mobile phones
and Personal Digital Assistants (PDA). M-Commerce is about the growth of
applications and services that have become accessible from internet enabled
mobile phones. M-commerce is popularly called the next generation of
E-Commerce. The technologr used to bring internet content and services to mobile
phones and other wireless devices is called Wireless Application Protocol (WAP).
WAP enabled mobile phones are very widely used today. These mobiles have
micro or WAP browsers which are used to access the web. All major mobile phone
manufacturers today such as Nokia, Samsung, Motorola etc. offer mobile phones
which are WAP enabled, have Bluetooth and other features. Many Mobiles have
an 'always on'unlimited internet service plan with increased bandwidth.
Apart from the WAP enabled mobile, and micro or WAP browsers which are
used to access the internet, WAP sites have been developed in a big way. WAP
sites are dynamically converted to Wireless Markup Language (WML) so that they
can be viewed using WAP browsers.
INDUSTRIES AFFECTED BY M.COMMERCE
The following industries are a.ffected by M-Comrnerce :
1. Brokerage Senricea I Stock prices are regularly displayed on the mobile
device and are available even when the person is on the move. Based on
these stock quotes trading can be conducted directly from the mobile
phone.
2. Financial Servlces : This includes mobile banking where bi1ls can be
paid using the mobile phone and customers have access to their bank
accounts while they are on the move.
3. Retail and Servicea : This enables the mobile phone users to order for
4nd pay for various services while on the move.
4. Information Services : This includes the sending of bricket scores, jokes,
news, astrolory etc. and even traffic updates.
5. Resenratlons : Here the mobile phone is used to make reservations in
airlines and hotels.
Currently M-Commerce is widely used for sales of mobile phones, ring tones
and games. Some companies are conducting experiments on speech recognition
software for mobile phones.

OBJECTIVE
I. State whether the following statenents are Trre or False :
1. Electronic Market is the virtual representation of physical market.
2. E-Commerce means buying and selling of products by consumers and businesses at
the local level.
3. In E-Commerce scope is local.
4. EDI stands for electronic data interchange.
5. EDI does not require printed order and invoice.
6. AII products and services can be sold through E-Commerce.
7. E-Commerce stands for Electrical commerce.
8. The cost of the products sold through E-Commerce is very high.
g. E-Commerce is the most secure and private system.
1O. Payment is done by credit card in E-Commerce.
22 t"t'tt' Computer Systems and Applications - T.Y.B.Com--(Sem. VI)

11. The full form of WAP is Wireless Associate Protocol.


12. M-Commerce means buying and selling of goods and services using a laptop.
13. M-Commerce means buying and selling of goods and services using a mobile phone
or a PDA device.
14. In SET the customer's credit card number is never seen by the merchant.
15. Online stored value systems allow the customers to make immediate online
payments to merchants and others, based on the amount that they have kept in
their online account.
16. Digital Cash is the electronic parallel of notes and coins.
17. Secure Socket Layer is a protocol developed by Netscape for securit5r of data in
transit.
18. A Digital Signature is a digital code that is attached to a message sent electronically.
19. In publlc Key Encryption there are two keys, one private and the other public.
20. ln Public Key Encryption there is only one key called the public key.
21. Decryption means converting readable text into cipher text
22. ln a Credit Card Transaction on the Net, the buyers credit card details are revealed to
the Seller.
23. One limitation of E-Commerce is lack of PC penetration.
24. ln SSL the URL changes to HTTPS from HTTP.
25. Non-repudiation refers to non denial of E-commerce Transactions.
26. Authentication ensures that the message was not read by others.
27. Symmetric key encqrption requires that both parties share the same key.
28. ln encryption the file contents are so scrambled that they cannot be read.
II. Choose the correct dteraative from the following:
1. The emerging market economy where consumers, producers and merchants interact
electronically is called.
a) E-Commerce b) E-market
c) Supermarket d) EDI
2. A computer to computer exchange of business transactions is called.
a) E-Commerce b) EDI
c) E-Market d) M-Commerce
3. Buying and selling goods and services over the internet is called.
a) EDI b) Internet Commerce
c) E-Commerce d) E-Market
4. The process of converting intelligible data into unintelligible data is called
a) Encr5ption b) Decryption
c) EDI d) E-Market
5. Conversion of data into code is called
a) Firewall b) Decr5ption
c) Encr5ption d) Password
6. Which product people more likely to be comfortable buying on the internet.
a) Clothing b) Food
c) Furniture d) All products
7. There are many techniques that B2C companies use to attract customers except.
a) Registering with search engines
b) Viral Marketing
c) Online Ads
d) Virtual Marketing
8. Which term describes the percentage of people who visit a website and buy
something.
a) Affiliates b) Click-through
c) Spam d) Conversion rate
E-Commerce Seatitg ll??' 23
9. In E-commerce, to authenticate the sender of the message we use.
a) Digital Signature b) privacy protocol
c) Digital Sending d) Digital protocol
lO. An SSL does not provide
a) Integrity b) Data Security
c) Authentication d) Confidentiality
1 1. It is a convention that all sites that use SSL connection while making a secure
connection, use instead of HTTP.
a) HTTPS b) PoP
c) FTP d) TCP/IP
12. SET ensures
a) Authentication
b) Non-repudiation
c) Both Authentication and Non-repudiation
d) None ofthe above
13. ebay.com is
a) Only C2C b) Only B2C
c) Only B2B d) Both B2B & B2C
14. Decryption refers to
a) Converting plain text into binary numbers
b) Converting plain text to cipher text
c) Converting cipher text to plain text
d) None ofthe above
15. SSL stands for
a) Single Socket Layer b) Secure Sockets Layer
c) Secure Standard Layer d) Simple Sockets layer
16. Criminally acquiring passwords is called
a) Encr5ption b) Phishing
c) Hacking d) Decryption
f 7. SET is an open standard in E-commerce offered by
a) Certification Authorities b) Microsoft
c) Master and Visa C. d) World Bank
18. In E-commerce the assurance that the message is not altered is known as
a) Authentication b) Confidentiality
c) Integrity d) Validation
f 9. A Public Key differs from the Private key due to
a) It being used only for encqlption
b) It being used only for decryption
c) It being shorter in Length
d) None ofthe above
20. The model in E-commerce where companies earn revenue by referring users to other
websites providing products/services is called
a) Sales Revenue b) Transaction Fee Revenue
c) Advertising Revenue d) Affiliate Revenue
21. Sender and Receiver have same keys in
'a) Symmetiic Key Encryption. b) Asymmetric Key Encryption
c) DES d) PKI
22. EDI stands for
a) Electronic Date Internet
b) . Electronic Data Inference
. 'c) Electronic Data Interchange '

O) Electronic Data Intake.


"
a
24 t't't" Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

23. There are many techniques used by B2C companies to attract customers except
a) Viral Marketing
b) Online Ads
c) Registering with search engines
d) Discount Price
24. T}re most commonly used form of paJrment in E-Commerce is
a) Credit Card b) PayPal
c) Petro Card d) Digital Cash

ANSWERS
13. [Tnre. 1,4,5, lO, 13,t4,15, 16,77,18, 19,22,23,24,25,27,28
Falso '. 2, 3, 6,7,8,9, lL, L2,20,21,26.1
14. [(1 -bl,e -b),.(3-c), (4-a), (5-c), (6 -dl,V -b), (8-d), (9-a), (10-d), (11-"),
(12-c),(13-b),(14-c),(15-b),(16-b),(17-c),(18-a),(19-a),(20-d),(21-al,
(22 - cl,123 - al, Qa - a\

OUESTIONS
1. Discuss the various securit5r issues in E-Commerce.
2. Explain the terms: Encryption and Decryption.
3. Discuss Private Key encr5ption.
4. Discuss Public Key encr5ption.
5. What are digitaf signatures? What are they used for?
6. Explain SSL.
7. Discuss the pa5rment systems used in E-Commerce.
8. Explain the working of an online credit card transaction.
9. What are the limitations of credit card payment systems?
1O. Explain the SET protocol.
I1. What is M-Commerce? What are its applications?

t ?'t"
Microsofi, Excel - Multiple Spreadsheets t'lr?' 25

ODULE II
DVANCED MS-EXCE

4 - Multiple
Microsoft Excel
Spreadslteets

TEMPLATES IN EXCEL
Microsoft Excel 2OO7 contains many features that allow the user to automate
certain tasks such as entering formulae, formatting a worksheet, etc. To avoid
repeatedly creating a worksheet from beginning, we could create a template and
reuse it with minor modifications.
A template is a predesigned utorksheet that you can use to create new
worksheets with l}:e same formatting and predefined formulae. Tlre template
worksheet contains all the formatting such as'font and layout information,
conditional formatting, labels, data, titles, and values.
CREATING A TEMPLATE IN EXCEL
1. Open new worksheet.
2. Enter all the data such as column headings, formulae, font information.
Align each column the way it is required.
3. Add or remove rows and columns as required.
4. Create charts.
5. Now save the template as follows:
a) Click on the Office button to open the drop menu.
b) Choose the Save As option.
c) Choose the Other Formats option.
d) Choose the Save As option to open the Save As dialog box.
e) Click on the Save as type option to open the drop down list.
0 Scroll through the list to find the template options.
g) Select the option Excel Template (*.xltx) and click on the Save button.
6. The template is saved in the templates folder on your computer.
LINKING MULTIPLE WORKSHEETS AND WORKBOOKS
. Excel can dynamically link a workbook to data in another workbook so that
any changes you make in one workbook are immediately reflected in the other
workbook. This other workbook may be situated on your own computer or it may
be situated on another computer which are connected through a network. We will
now explore this feature of Excel - linking worksheets and workbooks.
26 t't'l,' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

LINKING WORKBOOKS
The term linking refers to the process of creating formulas that use values
contained in another workbook. That is, worksheets are linked in such a way
that one depends on the other. The following terms apply to linking documents :
External Reference : This is a reference to another Excel workbook cell, cell
range, or defined name. A formula containing an external reference is called an
external reference formula.
Dependent Workbook : It is a workbook that contains a link to another
workbook. In other words, a workbook that relies on (or, depends on) information
in another workbook is called a dependent workbook.
Source Workbook : A workbook that is the source of the information referred
to in an external reference formula; source workbooks are referred to by
dependent workbooks.
Itrhy Ltnk Workbooks?
If a workbook A relies on the data in another workbook B, then linking of
workbooks becomes necessary. One may just as well copy the data from
workbook B into A, but this process can be very cumbersome. If workbook B is
being continuously updated from some source (say, the share prices of 5O0
companies in a stock broker's office), then it is impossible to update workbook A
manually. The only alternative is to use the method of linking.
Linking is also required sometimes if one of the workbooks itself would
contain too much data. In such a case, it is advisable to break up a large file into
two or more smaller files and link them with each other.
Linking has its drawbacks, however. If link in one of the formulas in linked
workbooks is broken, then the workbooks will be "out of s5rnc".
CREATING LINKS
The general syntax for an external reference formula is :
= [WorkbookName]SheetNamelCellAddress
The cell address is preceded by the workbook name (in square brackets), the
worksheet nalne, and an exclamatio4 point. E.g., tJle following fgrmula uses a
cell reference in the sheet named MarchExpd in a workbook named Budget 2008.
='[Budget2o08]MarchExpd'lProvisions.
The other workbook need not be open. If the above workbook was closed,
then we can use the formula
= D: \My Documents\ [Budget2oo8]MarchExpd'tProvisions
Here we have given the complete path to the reference.
Creating a link formula by polntlag
Reference formulas can be entered directly, but doing so may result in typing
errors (typos). Instead, one can let Excel build the formula for you.
1. Open the sourcebook.
2. Activate the cell in the dependent workbook that will hold the formula.
3. Begin entering the formula.
4. When you get to the part that requires an external reference, activate the
source workbook and select t\e cell or range.
'5. Finishthe formula and'pre"* BtttpR
Microsofihcel-Mukiple Spreadsheets d11'f 27

If tJ:e source workbook is open, the external reference will not include the
path to the workbook. But if you close the source workbook, the external
reference formulas will change so as to display the complete path.
Creatlng a llah fornula by parttag
The Paste Special command can also be used to create external reference
formulas :

1. Open the source workbook


2. Select the cell or range that ttrat you want to link, and copy it to the
Clipboard (right click and Copy).
3. Activate the dependent workbook and select the cell where you want the
link formula. If you are pasting a range, just select the upper left cell.
4. Right click and select Paste Special command and then click on the Paste
Link button.
Paste Special mEl
Paste

CIm Q il uong So.nce tfuame


O eorr*los O Al crc+t borders
CIy,*rcs O coftrnn uutctns
Oram+e Q fogrnlas ana rrnrtcr fonnets
O Cqrrnrnts $ valges and nunbcr formats
Ov*ruoo
Operdion
@ilqrE Ou*uv
OAdd Oo{viae
Os$Ert
trsSH.*3 E rrasposa

OK Concel
.
.ng. 4.1 : Sclcc+tig Perte Spccial
Eramplc : Let us consider an example of linked workbooks. First create a
workbook called UOIITHLYIIIC.XI,8X. This will be our source uorkbook Tirre
worksheet on this workbook is named MONTHINC and has the following contents
(Fig a.2).
UOIITIILYIilC.XLSX (Source workbook)
A B c D E G
I MONTH BASIC DA CI"A HRA GROSS DEDNS
2 Mar-O8 9300 344L 300 2790 15831 L260
3 Apr-O8 9300 3441 300 2790 1583r 1260
+ May-O8 9300 3441 300 2790 15831 1260
5 Totd 27900 10323 900 8370 47493 3780
6
? Other Income 1 1000
ry.4.2 t Sourcc Worlbool
The formulas in various.cells are :

CellF2:=SUM(B2:E;21.
Copy this formula in cells F3 and F4.
CellB5:=SUM(B2:841.

a
.) J
28 jPt/f Comgruter Sgsrems andApplimtions-T.y.B.Com.-(Sem. VI)

Copy this formula in cells C5, D5, 85, F5, and G5. Note how the formula
adjusts to take on relative references.
Now create a workbook named TAXCALC.XI,SX. This will be the dependent
uorkbook. Contents of tJlis workbook are shown in Fig 4.3 below.
TAXCALC.XLSX (Dependent workbook)
A B
I Tar Conputatioa
2 IGro"" Income
l

3 lDeductions
4 lN.t I.rcome
5 lOtn.r Income
6 lfaxable Income
? ltax Payable
Flg. 4.3 : Depcndcnt WorLbooL
As you can see, the contents of column B are empty. We will fill up the cells
in this column by linking cells from workbook MONTHLY-INC.XLSX.
Here are the steps to link these two workbooks.
1. Open the dependent workbook TAXCALC.XLSX.
2. Open the source workbook MONTHLYINC.XLSX.
3. Click on cell F5 (of MONTHLY-INC.XLSX) and copy the contents of this cell
to the Clipboard (Press CTRL + C).
4. Switch to TAXCALC.XI,SX workbook (ALT+TAB will work for switching).
5. In the worksheet TAXCALC.XLS, click on cell 82. Right click and select
Paste Special. Click on Paste Link button. You will find the value 47493
appears in cell 82. Also, obsenre the formula bar; the following formula
appears :
= [MONTHLYINC.xIsx]MONTHINCT$F$5
The first part of the formula (in square brackets) contains, the workbook
narne, followed by the worksheet narne, and the cell we copied from that
worksheet, cell $F$5. Note the absolute references in linking.
6. Activate MONTHLYIilC.XLSX and copy cell GS to Clipboard (press
CTRL + C). Activate TAXCAIf.XLSX. Select cell E}3.
7. Right click and select Paste Special and click on Paste Link button. You
will find the value 3780 appears in cell E}3. Also, observe the formula bar;
the following formula appears :
= IMONTHLYINC.xIsx]MONTHINCT$G$5
8. In cell 84 type the formula, =B.2-rr. '
9. In cellB5, type the formula, =[MONTHLYINC.xIsx]MONTHINC!$B$Z
10. In cell86, type the formula, =84+85.
1 1. In cell 87, type the formula, =15"86/ 1O0 (Tax rate 15%).

Note that we have tsed formulae, and relative referencing and these concepts
you have studied in Semester 5.
Microsofi Etrcel - Multiple Spreadsleets ,.il r' 29
The completed worksheet should look as shown below :
TAXCALC.XLSX (Dependent workbook) after linking with MONTHLY-INC.
xLsx
lr B
1 Tar Computatlon
2 lc.o"" Income 47493
Deductions 3780
Net Income 43713
Other Income 1 1000
Taxable Income 547L3
Tax Payable 8206.95

UPDATING LINKS
Whenever there is a chonge in the source utorkbook, t};.e dependent uorkbook
is automaticallg updoted. In the above example, change the contents of cell B7 in
MONTHLYINC.XLSX and observe how the contents of TAXCALC.XLSX are
automatically updated.
If the source workbook is closed, the cells in dependent workbook will not
update automatically.
USING FORMULAE AND LOGICAL OPERATORS
A spreadsheet is a number cruncher. It can perform various mathematical
calculations on numbers and for that it needs formulae. We have seen, in
Semester 5, how to create and use formulae. A few basic concepts of formulae
are :

o Excel formulae must start with the equal to symbol ( = ); this is how
A11
Excel distinguishes between a formula and text.
o Formulae may contain the following mathematical symbols : *, *, -, /, n
(exponentiation), 7o (percentage), brackets (and ).
a A formula can contain cell references, values, and worksheet functions.
a When you enter a formula in a cell, the cell displays the result of the
formula. The formula itself appears in the formula bar when the cell is
activated.
Logical formulae : These contain the relational operators (r ), =, )=, (=, ().
These operators operate on two conditions to produce a logical result. i.e., TRUE
or FALSE.
LOGICAL FUNCTIONS
Excel uses the following logical functions - AND, OR, NOT, TRUE, FALSE, IF
and IFERRORfl. All these logical functions return TRUE or FALSE as the result.
$I$tr , AND(logicatl,logical2,...) tests whether ttre logical arguments are TRUE
or FALSE. If ALL logical arguments are TRUE, the AND function returns TRUE. If
any argument is FALSE, the AND function returns FALSE. Thus, all arguments of
the AND function should be TRUE to get a TRUE output. Think of this as follows:
You are allowed to board an international flight if you have the ticket AND the
passport.

I \
30 l"9'n' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

.t
CottrmcDt
A FumrH*nhCdI cffir ofFmdr

2 =AND(Allo,82> 10) A3> 10 FALSE

12 5 =AND(A3>10,83> l0) A4>10 B4 >10 FALSE Sb m dlr b FAISE T€$I n FAISE

5 t2 84> A5>10 85 > FALSE SbcrccnrtrhsLFAISEE$hIFAISE


12 15
=ANI{A5>10,B5>
l0) A6>10 86> 10 TRUE Sircbddim ae IRIIE Itslb b TRUE

Ftt. 4.4 : The AI{D (f tunctton


S86 : OR (togical L, logical2,...) tests whether the logical arguments are TRUE
or FALSE. If atleast one argument is TRUE, the OR function returns TRUE. If all
are FALSE, the OR funetion returns FALSE. Think of this as the following
example: you are allowed to enter the college campus only if you have the ID card
OR the fee receipt(Ideally, atleastl). Even if you have both, You are still allowed
entry.

X'ormule in Col F Comment


2 +ror(Al>r0) Alll0 IRI]E
AIDIO

rtg.4.5 : Thc OR{f tuaction


I*ry : NOT (logfcaf test whether the logical argument is TRUE or FALSE. If
the argument is TRUE, the NOT function returns FALSE. If the logical argument
is FALSE, the NOT function returns TRUE. Thus, this function complements or
inverts its argument
nercmfurffm :

A fcn&inGolt l6*tls l kradril& (f,llmot


2 +l0TlA1D10) Al7 >10 nffi SincefleoditioristAlsEom&mntotilEtislRuE
t2 AI8>II) FAISE Sincetheo0diumislluqw$leflprtdthtilfA6t

FlS 4.6 : The lt(}f 0 tunctioa


FALSE : FALSEfl takes no argument and simply enters logical FALSE in its
cell -
tunction
2r Fsrfld.ln Col F tfimh
FATSE

=TRUE TRUE

Ftg4.7: The FAISE (l tuncttoa


: TRUE 0 takes no argument and simply enters logical TRUE in its
ce11.
-
Studgnt is advised to check the TRUEfl function on similar lines.
Ifr,: IF(logtcal-test, valuet, valuef) tests if the logical-test expression is TRUE
or FALSE. If TRUE, the IF function returns the valuet argument. If FALSE, the IF
function returns the valuef argument.
rtpFfltmdion{l
A B tunukintolf hr*dfflru& (mnefit

ryqf no
I
It{AItr{,'losilp is','tleFtyEl $mnumber inA2Tispositin,ilnfiI5tpadof $earyrentisprinted
J it{AH,'PoiitiE rd,'tle$lire'} ttqltir? Sinoenur6s k AB b n€Ftiredpxod nrytof tpsEltxrdis$ilted
It ) rr0i0(4D0, h901, "Bdt Positin" 'sdr arc nd puitiw') mrPositin Sinebdnmieraepoilire,Al{Dretuns1lUtadfirstaryumntb$wn
17 (
+lAl{D{l3S, 83001,'8dl hsitive','Bdl ae ndportive'l BdlmnotpGitiye $neBIb nqative,tcA+tl}returE FA$Eand $fieseondaBJmert brdntd

ftg,4.8 : The IFll tuactlon


Microsofi Excel- MultipleSpreadsheets t jl t' 31
Example : Consider the following spreadsheet. We will create formula to
perform the following tasks.
:,i:ai:i r:,,:,r:!:B:;i.r,ll;tr: r:,ri.,i,r,tr,rC:.r',,.,i

Grade Basic DA HRA


A 100m
B /t{looo
B 350(n
A 20(m

1. Find the DA as 600/o of Basic salary.


Ans : a) In cell C2, type the formula =0.6 * 82.
b) Drag this formula down to cell C5. Relative references are adjusted
automatically.
2. Find HRA as 107o of Basic il Basic salary is mere than 35000. Otherwise,
HRA is l2o/o of Basic.
Ans : Formula in cell D2 will be = IF(B2 > 35OOO, O.1 * 82, O.L2 * B2l
Condition Condition Condition
True? False?
Calculate Calculate
this this
Erample:
Write a formula that does the following :
o If cel1 A1 is less than 20, then multiply by 2, put result in cell 81
o If cell A1 is greater than or equal to 20, then multiply by 3
This requires the use of [F statement.
Ans : Here is the formula in cell81. =IF(AI <2O, AL*2, A1*3)
Example:
Write a formula that does the following :
. If cell A1 is less than 20, then multiply by 2, put result in cell 81
o If celI A1 is greater than or equal to 20 but less than 5O, then multiply
bv3
a If cell A1 is greater than or equal to 50 and less than 10O, then multiply
bv4
o If cellA1 is greater than or equal to 100, then multiply by 5
This fequires nested IF statements.
Ane. : Here is the formula to be used in cell 81
=IF(AI<20 , Alt'2,IF(AI<50, A1*3, IF(AI< 1OO, A1*4, A1*5)))
Example:
A college awards grades to students based on the marks they get, as per the
following table.
Marks Grade
o-59 F
60-69 D
70-79 C
80-89 B
90 - 100 A
32 t'ff Computer System^s andApplications-T.Y-B.Com--(Sem. VI)

Write a nested IF statement that will display the appropriate grade. Assume
mark is in cell A1 and grade must be displayed in cell81.
Ans. : Cell81 will have the formula:
=IF(A1 >=90,"A", IF(AI >=80,'B', IF(AI >=7O, "C", IF(A1 >=60, "D", "F'))))
IFERROR : IFERROR(ualue, errualue) tests whether the ualue expression is
an error. IFERROR returns emtalue if the expression is an error, or ualue of the
expression if it is not an error.
B c D
1 Quota UnitsSoH Forrrrula inColumn D Valu€ returned by Formula
2 2W =lFERRoR{A2/Ba "Error in calculation" ) 6
3 55 0 =IFERR0R{A3/83, "Error in ealculation"} Errar in calculation
4

tPlr4.g: The IFERROR(I tuncttoa


CREATING AND USING NAMED RANGES
A range in Excel is a group of one or more cells in a worksheet. A name can
be given to a range to make it easier to identiff this cell (or cells) when creating
formulae.
Named ranges are created by selecting the required
cells and then typing the name in the Name box located
above column A in the worksheet (Fig a.9).
A1 \,. :, " .&

Normally, we use cell references - such as C5 or E7 -


when creating formulas in Excel. Cell references point to
the location of the data to be used in the formula. The
I
advantage of this approach is that if you later change your data the formula
automatically updates to show the new result. Another advantage is that, it
makes it possible to copy formulas from one location to another in a worksheet
and the cell references change automatically.
The advantages of named ranges are:
1. They make complex nested formulae more readable and understandable.
2. They make it easy to quickly select a group of cells or find a cell. Navigating
throug[ large worksheets becomgs easier.
3. It is easier to apply formatting to named ranges.
4. They reduce the likelihood of some types of errors. E.g., if we have to refer to
a cell C23 we may, mistakenly, refer to it as cell C22. This will lead to
erroneous results. But if the cell C23 was named as TaxRate, then it is less
likely that a mistake will be made.
5. Named ranges use absolute references. So when we copy a formula from one
cellto another, the reference does not change.
Creating a llamed Range:
1. Select the cells you want to name. You can n€rme a single cell or a range of
cells.
2. Click inside the Name Box. The Name box is just above column A.in the
worksheet, to the left of the formula bar.
3. Start typing the name you want to give to this cell. Press Enter.
Microsofi Excel - Multiple Spreadsleets t tn3o 33
Erample : Let us create a two named ranges for the following worksheet
Fig a.10).
Name Box D

!
i

Tax Rate 0.3 < we wish to name

Name lncome Tax


Raiesh
Range we wish to
-7(nm 21(xrcO
Namlta lsomoo 15(xm
rename 7 Kishore { nsmoo ljl5(m
Punit lssomo 158000

Ftg. 4.1O : Namiag cellr ln a workchcet


1. Select cell C2. The Name box will show the address of this cell as C2. Click in
the Name box and type TaxRate (no spaces). Press Enter. Now the cell C2 has a
name called TaxRate. Whenever you select cell C2, you will find this name
appearing in the Name box.
2. Select the range C5:C8. The Name box will display C5 which is the address of
the first cell in the range that you have selected. With this range selected, click in
the Name box and drpe Income. Press Enter. The Name box will now display the
word Income if you click on any cell in the range C5:C8. Thus this entire range
now has the name Income.
3. Now we can calculate the total tax in cell P5 by two methods :
af Method I: Using cell references : In cell D5, type the formula =C5*C2.
But when you copy this formula down to cells D6, D7 and D8, the
formula no longer refers to the cell C2. References to cell C2 }::ave changed
as it was used as a relative reference. The results are wrong!
bf Method II: Using Named ranges : Since we have already named the
cellC2 as TaxRate, and the range C5:C8 as Income, we can simply write
the formula in cell D5 as follows : =Income " TaxRate. As this formula is
copied down to cells D6, D7 and D8, the cell references automatically
change. The results are correctl
Named ranges use absolute references so that even when the cells are
moved, the formulae are not changed. Try this: Select the named range
TaxRate (i.e. cel1 C2), cut and paste it into cell Fl. You will find that the
results are still correct. This will not work if you delete cell C2 and type it
in some other location. You must cut and paste.
Deleting a Named Range :
Fomubt

<-click here

Tax
210000

fig 4.11 : To delete a Named Renge


34c1.'.ConqrutcrsystemsandApplimtions_T,Y,B.Com..(*ttt.vl)
To delete a named range, follow these steps (Fig 4.1 1) :
1. Select Formulas in the Excel ribbon area.
2. Select Name Manager. The following dialog box pops up (Fig 4.121.
3. Select the name you wish to delete and click on Delete button in this dialog
box.
4 Click Close button to close the box.
Ilnlre l,{nrrdBrr ?x
Edit. tdete

l.n* vdt R.fat To S@c CorE*


€lrrm 0@;W... '.sullfcFrfcts Itrs*tod,
€ Tacf,.tc 0.3 .,slE tllt(P $dtbof.

NlS4.l2: Dclctlag a f,ancd rangc

O&IECTTVE QUESTIOIYS
I. State whethcr thc follorlag are ttrc or felrc :
1. A formula may start with any symbol.
2. Worksheets can be linked with each other only if they are in the same workbook.
3. When a worksheet in one workbook is linked wit],. another worksheet in the same
workbook, then the workbook name does not appear in the linked formula.
4. A template has the file name extension .XLTX
5. Named ranges use absolute referenqes.
6. Worksheets created with a template can have same formatting but cannot use
predefined formulae.
7. A template is saved in the templates folder.
8. An external reference is a reference to a cell in another Excel workbook.
9. A dependent workbook contains a link to another workbook.
10. There are no drawbacks to linking workbooks.
11. The general syntax for an external reference formula is :
= [WorkbookName]SheetNameiCellAddress
12. The Paste Special command can be used to create external reference formulas.
13. If
there is a change in the source workbook, the dependent workbook is not
automatically updated.
14. Logical formula can contain only the *, -, * alad I operators.
15. A logical formula can have only two possible outputs: TRUE or FALSE.
16. The logical function AND returns the value TRUE only if all the conditions in it are
TRUE.
17. The logical function OR returns the value FALSE if any one condition is FALSE.
18. The logical function NOT returns the value FALSE if its argument is FALSE.
19. The advantage of creating named range is that it makes the formula more readable.
20. Once a named range is created, it can be edited or deleted.
Microsofi, Excel - Multiple Spreadsheets lr,t,3;, 35
U. Multiple Choice Questions
Select the most appropriate alternatlve from amoagst those glven and rewrite
the sentence :
1. When you are typing a formula in a cell. The first thing that must be entered is :
a) the first cell referenced. b) parenthesis.
c) quotation marks. d) an Equal sign.
2. Which of these is the correct way of referencing a cell A1 on worksheet named
Admissions2OO9 in the same workbook :

a) =Admissions2OO9lAl b)
=Admissions2oog-A1
c) =A1lAdmissions2oo9 d)
=Admissions2oog
3. When referring to a cell in another worksheet (same workbook), the sheet reference is
always _, while the cell reference may be _.
a) absolute, relative b) relative, absolute
c) mixed, absolute d) relative, mixed
4. The result of a logical formula is
a) a logical value True or false b) a text va-lue
c) a numeric value d) an error message
5. Excel templates have the file narne extension
a) .temp b) .xltx
c) .xtemp d) .xls
6. A template worksheet contains the following information:
a) font and layout information b) conditional formatting
c) labels d) all of these
7. Consider the formula =[MONTHLYINC.xIsx]MONTHINC!$F$5. In this formula,
a) MONTHLYINC.xIsx is the external reference
b) [MONTHLYINC.xIsx] is the external reference
c) [MONTHLYINC.xIsx]MONTHINC is the external reference
d) [MONTHLYINC.xlsx]MONTHINC!$F$5 is the external reference
8. If cell A3 contains 10 and cell A4 contains 15, then what is the return value of the
formula = AND(A3 > 9, A4 < 2O)?
a) TRUE b) FALSE
c) 2s d) -s
9. If cell A3 contains 10 and cell A4 contains 15, then what is the return value of the
formula = OR (A3 > 9, A4 < 5)?
a) TRUE b) FALSE
c) 2s d) -5
10. If cell A3 is named PassMks and contains the value 40, cell A4 contains the number
76,what is the value of the expression =IF (A4 >= PassMks, 'Pass", "FaiI")?
a) Pass b)
Fail
c) Error d)
None ofthese
1 1. A selection consisting of two or more cells on a worksheet is called
a) Area b) Unit
c) Range d) Name
12. Which of the following is a valid external reference formula?
a) =<2008 Forecast>Fourth Quartert$D$8
b) ={2008 Forecast}Fourth Quartert$D$8
c) =[2008 Forecast]Fourth Quarterl$D$8
d) =[2008 Forecast]tFourth Quarterl$D$8
ANSWERS
I. [True : 3, 4, 5,7, 8,9, lI, 12, 15, 16, 19, 20
False z 1,2,6, 10, 13, L4,17, 181
III. [(1 -d), (2-al, (3-a), {4-al, (5-b), (6-d), (7-d), (8-a), (9-a), (10-a), (11 - c),
(12 - c)l
4/T.Y.B.Com - Com. Sys. & Appl. (Sem. -VI)
36 t't'l,' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

QUESTIONS
I. State the steps to perform the folloslng operatloas i! Uicrosoft EacGl :
l. Add the contents of cell Al of Sheet2 and contents of cell E}1 of Sheet3 and store the
result in cell ,{1 of Sheetl. (Assume active worksheet is Sheetl).
2. Multiply the contents of cell A1 of Sheetl in workbook "C:\My Documents\
Expd2gOO" by 1O, and store the result in cell A1 of Sheetl of the currently open
workbook.
3. Create a template in Excel.
4. How can an external link be created by pointing.
5. How can a narired range be created for the range of cells C5:C20?
6. How can a named range be deleted for the cells C5:C2O?
7. Cell Al contains the speed of a vehicle. Write a formula in cell B1 that dtsplays "Safe"
if speed is less than or equal to 5O, otherwise it displays "Slow Down"
II. Wrlte shott answerg :
1. What is a template? State the advantage of templates.
2. Explain the advantages of linking worksheets.
3. Explain the general syntax for an external reference formula.
4. Explain how a link formula is created by pointing.
5. Explain how a link formula is created the Paste Special command.
6. What are logical operators in Excel? Explain any three of these.
7. Explain the IFERROR$ function with a suitable example.
8. Define the term tramed range'.
9. State advantages of a named range.
10. Which type of referencing does a named range use? Why?
PRACTICAL EXERCISES
l. The following data is entered in a worksheet :

A B c
1 Name Basic TA
2 Nikhil 22000
3 Reema 27000
4 Namrata 27500
D Bhavika 20500
6 Rajesh 25000
Cell C2 contains the formula
= IF(82 < 23OOO, 1500, IF(B2 < 25OOO, 1800, 2000)).
This formula is copied down into the range C3:C6. What are the values shown in
cells C2:C6?
2. Consider the following spreadsheet which shows the marks obtained by 6 students
in an exarn. Write steps to obtain the average where average is the average of the
best five subjects for each student. The result is "Pass" if average is 5O or more and
"Fail" otherwise.
A B c D E F G H I
1 NAME ENG HINDI ECO BK AIC Tax AVERAGE RESULT
2 HEENA 78 69 77 65 88 73
3 SHWETA 87 79 75 77 91 81
4 FALGUNI 81 68 80 60 87 81
5 AKSHATA 64 59 58 61 69 63
6 ASHWINI 72 63 65 61 70 7t
Microsofi Excel - Multiple Spreadsh.eets t't"t' 37
3. In a worksheet, Names are entered in column A and corresponding Basic Pay is
entered in column B for 3O persons the first row contains the heading and the rest of
the rows contain data. Write the steps to obtain in column C, D and E the HRA, DA
and Total Pay where HRA is @ 2Oo/o of basic pay or Rs 5OO0 whichever is less, and
DA is 25o/o of basic pay whenever basic pay is less than 5OOO otherwise it is 4O% of
basic pay.
4. A University decides to scale down the marks of a student in Internal exams as
compared to the marks obtained by the student in the Semester End Theory exam in
the subject concerned. The rule is as follows: If the percentage of marks obtained by
the student in Internal exam and Semester exam differ by more tl:an 2Oo/o than the
percentage of marks in the Internal exam should be scaled down to 2Oo/o. If the
difference in percentage is less than 2O%o, the Internal marks are not changed. If the
Semester percentage is more than Internal percentage, the Internal marks are not
changed. Assume that the student is passing in the course. Write the formula in
various cells that will generate the data shown in ranges,C3:C5, E3:G5. Data in other
cells is to be assumed.
A B I
C D EF G
1 Semester Mlts Semester%pcE lnt Mh-Org lntwnalkQ Diff in Pclg Ret is€d lnternal
2 Max Mks--> 50 N
3 Atrts 30 50 38 95 its 8
4 Eco 49 82 t7 93
I
11 37
I
Maths 58 9? 37 93 -4 37
6

t'''t"
38 t't"t" Computer Sys/ems and Applications - T.Y.B.Com.-(Sem. VI)

5 Microsoft Excel
Functions

F'UNCTIONS IN EXCEL
We have already studied a few functions in Excel in Semester 5. These were
the financial, mathematical and statistical functions. In this chapter we study a
few more functions that are extremely useful for commercial applications. At the
end of this chapter, you will be able to :
o Use string-handling functions.
o Use functions for working with dates.
a Apply conditional logic functions in spreadsheets.
a Use database functions to lookup data.
FUNCTIONS REVISITED
In this section, we briefly revise the basic concepts of a function. You can
refer to the textbook of Semester 5 for details of Excel functions.
Frrnctlon t A function is a special prewritten formula that takes a value or
values, performs an operation, and returns a value or values.
Function Arguments : The values that we supply to the function, within
parentheses, are called the function arguments. Functions may have :
a No arguments
a One argument
a A fixed number of arguments
o Any number of arguments
a Optional arguments
Return Values : The values that a function produces after computation, are
called the return ualues. The values returned by a function can be used by other
fu nctions for further calculations.
Syntax : The sequence of characters used to enter a valid function is called
the sgntax. All functions have the same basic s5rntax. The function name is
followed by the arguments in parentheses. If a function uses more than one
'argument, each argument is separated by a comma.
ENTERING FUNCTIONS
Excel's built-in functions can be entered either manually or by using Excel's
Function Wizard.
Entering a function manually is the most eflicient way, if you know the exact
syntax of the function, that is how many arguments it requires, the sequence of
arguments, etc. Excel always converts the function you enter into uppercase. I/
Excel does not conuert the function name into uppercase, it indicates that tlrcre is an
error in the function, magbe it has not been spelled conectlg.
- Functions
Microsofi Excel jl'jl'tt 39
Function Wlzard
The second way in which you can enter a function is by using Excel's
Function Wizard. The function wizard ensures that the function is spelled
correctly, and has the appropriate number of arguments.
Formular
.,,.
Dutu.. Re

-e & lookuF & Reference -


Jx 6s Math & Trig -
InsBrt
Funrtion @ Finanriat t

Fig. 5.1 : F-rraction Library


Here are some other methods to start the Function Wizard :

o Press SHIFT + F3
a Function Wizard can be started by clicking on Formulas and then
selecting the appropriate function category from the ribbon :
The Function Wizard dialog box appears (Fig. 5.1)
This dialog box shows the different categories of functions available in Excel.
When you select a category, the Function Name box displays the functions in that
category.
When a function is selected in the Function Name box, the name of the
function and a brief description of this function appears in the dialog box.
The student is advised to practice the topic on Excel functions by using the
functions directly in the formula bar.
lnselt Fttnctirrn

f- q" --l
Most Recently Used

Returns the number of days between two dales basad on a 350-day year (twelve
30-day months).

OK Cancel

Fig. 5.2 : Iasert Functlon Didog Bor


CATEGORIES OF FUNCTIONS IN EXCEL
Excel provides built-in functions in the following categories :

1. Database functions
2. Date and time functions.
3. Engineering functions.
4. Financial functions.
5. Information functions.
6. Logical functions.
40 t"t"tt' Computer Sgstems andApplications-T.Y-B-Com.-(Sem. VI)

7. Lookup and reference functions.


8. Math and trigonometry functions.
9. Statistical functions.
10.Text functions.
1 1. User-defined functions.
Although each of these categories contains many functions, only those
functions which are in the syllabus of T.Y.B.Com Semester 6 are discussed in
this chapter. For more help on functions not described here, please refer to the
online Help in Excel and our text book for Semester 5.
In case after typing a function name you get the following error message:
#NAME?, it means that there may be a spelling mistake in typing the function
nalne.
DATABASE (LOOKUPI FUNCTIONS
LOOKUP
htrpose : This function looks up a value in a single row (or a single
column) of data. It returns a value from the same position
in the second row (or second column).
Sgntax : LOOKUP (lookup_value, lookup_range, result_range)
Lookup_ualue : It is a value that LOOKUP searches for in the lookup range.
Lookup_value can be a number, text, a logical value or the
address of a cell that contains the value. This value is also
called as the "key" value.
Lookup-ranse:l'.[:'ffi -;imi::#x."""#vo.'Hi:"ff
values.
ffi ::yi:;T
Important : The values in lookup-range must be placed in ascending
order: ...,-2, -1, 0, 1, 2, ..., A-2, FALSE, TRUE; otherwise,
LOOKUP may not give the correct value. Uppercase and
lowercase text are equivalent.
Result_range : A range that contains only one row or column. It must be
the same size as lookup_range.
If the Lookup function can not find an exact match, it chooses the largest
value in the lookup_range that is less than or equal to the value.
Example 1:
The following worksheet contains names of
countries in column A and names of cities in column 2 Vienna

B. We wish to enter a countr5r name in cell BlO, and 4 Dusseldorf


get the name of the corresponding city in cell B 1 1. lndia New Delhi
In cell B11, t5rpe the formula : =LOOKUP(BI0, 6

A2:A8, 82:88) Srlritzerlaod Geneve


USA C
In cell B10, Qpe Austria. Cell B11 will display :

Vienna to rearch: Austfla

Erplanatlon : Consider the formula = LOOKUP


(810, A2:A8, 82:88) ftg. 5.3 : To lllustrate the
i) The first parameter 810 means what to use of the IOOKUP fuactlon
search for, i.e., the value given by cell B10 (in this example it is Austria),
ii) The second parameter A2:A8 means where to search (in this example, in
the range A2 to A8)
iii) The third parameter B2:B8 means, if a match is found look up the
corresponding value in the range 82:88.
Microsofi Excel - Functions jl"3l"3l' 41

In this example, we are searching for the country "Austria" as it is typed


in cell B10. Excel searches for "Austria" in the range A2:A8. Since it finds the
match in row 2, it returns the corresponding value i.e., Vienna from the range
82:88.
Example 2 :
What is the output of the following LOOKUPfl function?
=LOOKUP("C", {'A"r"B"r"C"r"D"i" l" r"2" r"3" r"4"})
Explanation : Firstly, we observe that there are two rows of data. The first
row consists of "A","B","C","D" foltoued bg a semicolon. The second row of data is
"L","2","3","4" which is the part after the semicolon. We are now searching for the
value corresponding to the letter 4C" (the first argument inside LOOKUP
function). So, Excel searches for "C" in the first row, finds a match, and gives its
corresponding value from the second row, which is "3" ',"
So the result is'3"
VLOOKUP
Purpose : The VLOOKUP function allows you to look up values
in the first column of a range of values (table) and returns
a value in the same row from another column in the
table.
Sgntax VLOOKUP (lookup_value or key_value, table_range,
column_number, range_lookup)
Lookup_ualue The value to search in the first column of the table.
(or keg ualuel Lookup_value can be a value or a cell
address.
Table_range It is two or more columns of data. We must use a range
address or a range name. The values in the first column
of table_range are the values searched by
lookup_value(key value). These values can be text,
numbers, or logical values. Uppercase and lowercase text
are equivalent.
Column_number The column number in table_range from which the
matching value must be returned. A column_number of 1
returns the value in the first column in table_range; a
column-number of 2 returns the value in the second
column in table_range, and so on.
Range_lookttp A logical value that specifies whether we want VLOOKUP
to find an exact match or an approximate match. Use
TRUE or omit this value to find approximate match; use
FALSE to find exact match. If using TRUE, the values in
the first column of table_range must be placed in
ascending sort order; otherwise, VLOOKUP may not give
the correct value.
Erample:
The following worksheet contains names of currencies, countries and cities
as shown below. User can enter the currency name in cell B11,. and the
VLOOKUP function will be used to display the corresponding country name and
city name in cel1s El8 and El9 respectively.
42 l''l''l,' Computer Sysfems and Applications - T.Y.B.Com.-(Sem. VI)

1 Country City
2 Dollar USA DC
3 Yen
4 Pound London
5 lndia New Delhi
6 Dinsr Bahrain Manama
7
& Csuntry
9 CitY

"""'."".""""':&*

ffg. 5.4 : Illustratlag the ure of VLOOKUP(f tuirctioa


In cellB8, type the formula: =VLOOKUP (E}11, A2:C6,2, FALSE)
In cell 89, Qrpe the formula : =VLOOKUP (B11, A2:C6,3, FALSE)
If the user tJpes Yen in cell B11., cell E}8 shows Japan and cell 89 shows
Tolryo
Explanatlon : In cell 88, the formula is =VLOOKUP (B11, A2:C6,2, FALSE).
We wish to search for the string entered by the user in cell B 1 1. This value of B 1 1
will be looked up, vertically, in the range A2:A6, and the corresponding value in
the same row from column number 2 {i.e., the Country column) will be displayed.
FALSE implies we want an exact match. The formula in cell B9 is similar, except
that we are looking up a value in column 3 (i.e., City column).
HLOOKUP
htrpose : The HLOOKUP function (short for Horizontal Lookup),
searches for a value in the first row of a table and returns
the corresponding value in the same column from another
row in the table array. Thus, this function is similar to the
VLOOKUP function but searches horizontally.
Sgntax : HLOOKUP (lookup-value or key_value, table_range,
column_number, range_lookup)
Lookttp-ualue : The value to search for in the first row of the table array.
(or key_value)
Table-range : TWo or more rows of data. The values in the first row of
table_range €rre the values searched for the lookup_value.
These values can be text, numbers, or logical values.
Uppercase and lowercase texts are equivalent.
Rout_number : The row number in table_range from which the
corresponding value must be returned. A row_number of 2
returns the value in the second column in table_range; a
row_number of 3 returns the value in the third column in
table_range, and so on.
Range-loolcte : A logical value that specifies whether you want HLOOKUP to
find an exact match or €rn approximate match. If set to
"FALSE", a corresponding value will be returned only if an
exact match is found. If set to "TRUE", the nearest match
will be considered if an exact one is not found.
The values in the first row of table amay must be placed in ascending sort
order; otherwise, HLOOKUP may not give the correct value.
Microsofi Excel- Functions t?rjl, 43
Example:
The following worksheet contains names of currencies, countries and cities
as shown below. User can enter the currency name in cell 89, and the HLOOKUP
function will be used to display the corresponding country name and city narne in
cells 86 and B7 respectively.
Al D I
ErF
CurrencT tlollar Yes Pound Rupee Dinar
Country USA Japan UK lndia Bahrain
City Washington DC Tokyo London New Delhi Manama

Country
City

Curency
ffg. 5.5 : To lllustrate the ure of HLOOKUP function
In cell86, type the formula : =HLOOKUP(B9, B1:F3, 2, FALSE)
In cell 87, type the formula : =HLOOKUP(B9, B1.:F3, 3, FALSE)
If the user t5rpes Yen in cell89, cell B6 shows Japan and ceII87 shows Tokyo
CONDITIONAL LOGIC FUNCTIONS
. Excel has several logical functions that enable you to test cells and perform
different operations depending on their contents.
IF
h.trpose :
Rehrrns one value if a condition you speciff evaluates to TRUE
and another value if it evaluates to FALSE.
Sgntax : IF(logical-test, value-iltrue, value-iffalse)
The IF function takes three arguments. the first argument is a logical test
that must be either TRUE or FALSE. The second argument is the formula's result
if the first argument is TRUE. The third argument is tlle formula's result if the
frst argument is FALSE.
Example 1:
If cell A1 contains a number greater than 0, the following formula returns the
result Positiue and returns the value Negatiue otherwise.
=IF(AI > 0, "Positive", "Negative")
Here is an example using the IF function to calculate the sales commissions.
In this example, the normal commission rate is 5o/o of sales. If the sales
representative exceeds the sales goal, the commission rate is 6.5%.
A B c
1 Sales Goal 150,000
2 Commission Rate 5.00%
3 Bonus Rate 6.5Oo/o
4
5 Sa1es Rep Sales Commission
6 Earned
7 Anjali 150,O00 7,500
8 Deepali 2OO,5OO 13,033
I Dilip 110,000 5,500
Jitesh 95,000 4,750
Fig. 5.6 : lllustratlng the use of IF fuaction.

\ \
44 t'r'f Computer Systems and Applicatiorts - T.Y.B.Com.-(Sen. W
The formula in cell C7 is
=IF(87>salesgod, B7*bonusrate, B7*commissionrate).
It uses the IF function to make a decision regarding which commission rate
to use based on the sales amount. Not that we have named the cells El1 as
salesgoal, 82 as commissionrate, and 83 as bonusrate.
Example 2 :
The following worksheet contains the marks JI oa
UL
obtained by students in an exam. Marks are 1 Name Marks Result
stored in column B. Column C should contain 2. Anjali a7
the result oPass' or "Fail" depending on the
Preeti 69
marks obtained by the student. Passing mark is 3
40. 4 John 31

In cell C2, type the formula =tF(82 >= 40, 5 Aishwarya


"Pass", 'Fail') 6 Deep t7
Drag this formula upto cell C6. Fig. s.? : To i,ustrate the use of
Cell C6 will show either "Pass" or "Fail" the lF firnctioa
depending on the marks scored by the student.
Change the marks of Deep to 73 and see the new result in cell C6.
Modlflcatloa of the above erample :
A spreadsheet contains Roll no. and marks out of 100 in 4 subjects entered
in columns A, B, C, D, E respectively in first 26 rows. The first row contains
headings and subsequent rows contain data. Write the steps to find average and
grade in column F and G respectively where Grade is to be assigned as follows :
Average Grade
75 or more A
6O or more and below 75 B
Below 6O C
ITESTED IF
IF conditions can be nested (one IF inside another) to create very complex
conditions. Consider the example where a teacher assigns grades instead of
marks to students. Let us assume the grading score is as follows :
Marks Grade
<52 F
52-63 D
64-74 c
75-84 B
85-99 A lEiF
Now suppose the marks of students are as follows : Roll No Marks
We want to write a formula, using nested if, that will give tJ:e I a5
corresponding grades in column G. 2 57
1 63
In cellG2, we type the formula: 4 45
=IF(F2<52,"F",IF(F2<64,"D',IF(F2<7 5," C",1F(F2<85,"8","A")))) 5 78
Let us understand this formula: the various parts of this 6 85
formula have been underlined to explain it. The Iirsi condition is 7 84
IF(F2 < 52... and if this condition is true, we use the "F" grade. If 8 52
the first condition is false we jump to the second condition: F2 < 9 27
64; If this condition is true then we use the "D" grade. If the 10 ffi
- Functbns
Microsofi Etccel ,'t,?' 45
second condition is also false, we jump to the third E
condition: F2 < 75; if this condition is true, we use Roll Ho Marks Grade
the grade "C". lf this condition is also false, we jump 1 65 C
to the fourth condition: F2 < 85; if this condition is
2 57 D
true we use the grade "E}". If this condition is also
false, we use the default grade "A". 3 63 D

The final spreadsheet is: 4 45 F

Nested conditions are very useful for many such 5 78 B

examples such as income tax calculation based on 5 85 A


income slabs, bonus based on sales, etc. But avoid 7 'l 84 B
using more than 5-6 levels of nesting as otherwise I 52 B
the formula can become very complicated and 9 27 ts
difficult to debug. VLOOKUP and HLOOKUP are 10 il c
alternatives to nested if statements.
COUNTIF
Purpose : Counts the number of cells within a range that meet the given
criteria.
Sgntox : COUNTIF (range, criteria)
Range : is the range of cells to count. Blank and text values are ignored.
Citeria : is the criteria in the form of a number, expression, or text that
defines which cells will be counted.
Using wildcard characters in COUNTIF :
o We can use the wildcard characters such as question mark (?) and
asterisk (*), in criteria.
o A question mark matches any single character.
a An asterisk matches any sequence of characters.
a If we want to find an actual question mark or asterisk, type a tilde (-)
before the character.
Examples: A

1. The following worksheet contaiqs marks obtained by students. Marks

We wish to display in cell A1O, the total number of students


87
64
securing less than 35 marks. 4 ?9
In cellA10, type the formula =COUNTIF(A2:A9, ".35") 5 :l4
This will count the number of cells in the range A2 to A9, which
satis$r the given condition i.e., <35 7 69
I
2. The following worksheet contains names of fruits.oes", We wish to
9 25
count the number of fruits that contain the pattern "apple",
"ng", character 'b", and consisting of exacfly 5 characters only.
Fruit

Fig. 5.8 : To illustrate the use of COITNTIF stth wildcard characters

\ l.
46 l,'t't' Computer Sysfems and Applications - T.Y.B.Com.'(Sem. VI)

Task f'ormula Result


To display in cell A9, number of cells ending with =COUNTIF(A2 :A8, "*es") 3
tes'

To display in cell Al0, number of cells ending =COUNTIF(A2:A8,'*apple") 2


urith "apple"
To display in cell A1l, number of cells containing =COUNTIF(A2:A8, "*ng*") 2
au5rwhere, the pattern "ng"
To display in cell A12, the number of cells =COUNTIF(A2 :A8, "*b*") 1

containing the character b, anywhere in the


string
To display in cell Al3, the number of cells that :COUNTIF(A2 :A8, "?????.) 1
contain exactly 5 characters
SUMIF
Purpose : Adds the cells which satisff a given criteria.
Sgntax : SUMIF(rErnge, criteria, sum_range)
o Range is the r€rnge of cells that that must be evaluated by the criteria.
o Criteria is a condition which may involve comparison operators such as
(, (=, ), )=, =, etc
o Sum-range are the actual cells to add if their corresponding cells in range
match criteria. If sum-range is omitted, the cells in range are both
evaluated by criteria and added if they match criteria.
Example 1 :
Consider the following worksheet which contains marks in cells ffi$A
A1 to A6. We wish to calculate the sum of marks but only if marks 45
>= 35. fi
In cell A7, type the formula: 3 I
3l
=SUMIF(A1:A6, ">=35"1 8:
We get the result 276 in cell A7. This is the sum of 45 + 67 + 75 6l 3{
+ 89. We see that the cells with values 31 and 30 are not included
e
in the final result.
AVERAGEIF
Purpose :
Returns the average (iarithmetic mean) of all the cells in a range
that meet a given criteria.
Sgntax : AVERAGEIF(range, criteria; average_range)
Range is one or more cells to average, including numbers or narnes, or
references to other cells that contain numbers.
Citeria is the criteria in the form of a number, expression, cell reference, or
text that defines which cells are averaged. For example, criteria can be expressed
as 27, "27" r ">27", "passt', or G3.
Auerage-range is the actual set of cells to average. If omitted, range is used.
Microsofi, Excel - Functions l,'t"t' 47
Consider the following data :

,-*-*.^-*.::-,-;; .. ,9-.,
-
1 Gender Age
2 M 19
M 18
4 F 20
5 M 21
F za
F 18
I M 19 I

M 20
F 18

Average MaleAge 19.4


Average FemaleAge 19

We wish to find the average age of males and average age of females. Data is
available in range A1:B10.
In cell 812, type the formula =AVERAGEIF(A2:A10, "Mu, B2:B1O). In this
formula, A2:A10, oM" means we want to search for all males ("M") in range
A2:A1O and their ages are available in range B2:B10.
Similarly, in cell E}13 type the formula =AVERAGEIF(A2:A10, uF", B2:810).
The average ages are shown in cells 812 and 813. q
.,: ,r:S,i,'; :
Example 2 : L Roll No Marks
A teacher has stored the marks in an exam as follows z 1 46
and she would like to know the average marks of the z 53

class, but excluding the absent students. Write the 3 39

formula to obtain the average by excluding the absent 4 ABS

students. 5 48
6 ABS
Since we want to ilnore those who were absent in the 7 26
exarn, we assume their marks are > O. In cell B13, type the I 33
formula I 38
=AVERAGEIF(82:81 1,',)=0u, B2:81 1) 10 ABS

isrrurc Furcrrons Average


A string is a collection of characters enclosed between
the quotation marks "and". Examples of strings are: "Microsoft", "MUMBAI",
"MBA", "University of Mumbai', oNew Delhi 110 O10", "A", "2389". Note that the
last example of string contains the digits 2,3,8, and 9. However, the string "2389"
is not the same as the number 2389. This is because, while we can do
mathematical calculations on the number 2389, we cannot do any such
calculations on the string "2389". If no calculations have to be done then a
number can be represented as a string. For example, telephone number may be
stored as a string, "9869012345".
Although Excel 2OO7 is well known for being a number churning software, it
has many functions to manipulate text strings.
48 t|'t"t' Computer Sysfems and Applications - T.Y.B.Com'-(Sem' W)

LEFT
hrpose : Returns a string of characters of a specified length from another
string, beginning at the lefimost position.
Sgntax : LEFT(text, nurn-chars)
Tert is the text string that contains the characters you want to extract,
Num-clnrs specifies how many characters you want the function to extract.
o Num-chars must be greater than or equal to zero.
o If num_chars is greater than the length of text, the LEFT$ function
returns all of text.
o If num-chars is omitted, it is assumed to be 1.
Example:
i) LEFT ("COMMERCE", 3) returns the string "COM", which is the first 3
characters from the left hand side of the string "COMMERCE"
ii) LEFTfCOMMERCE") returns the left-most character "C" only, since we
have not specified the number of characters and the default is 1
character.
RIGHT
hrpose : Returns a string of characters of a specified length from another
string, beginning at the rightmost position.
Sgntax : RIGHT(text, num_chars)
Text : is the text string that contains the characters you want to
extract, Num_clnrs specifies how many characters you want the
function to extract.
a Num_chars must be greater than or equal to zero.
o If num-chars is greater than the length of text, the RIGHT$ function
returns all of text.
o If num_chars is omitted, it is assumed to be 1.
Examples:
i) RIGHTfTELEPHONE", 5) returns the string "PHONE", which is the first 5
characters from the righthand side of he string "TELEPHONE".
ii) RIGHTfCOMMERCE") returns the right-most character "E" only, since we
have not specified the number of characters and the default is 1
character.
MID
Putpose : The MID function returns specific number of characters from a
text string, starting at the position you specify (ie. It returns
characters from the middle of the string).
Sgntax : MID(text, start-position, number-of-chars)
Text : is the text string containing the characters you want to extract.
Start-position is the'position of the first character you want to extract in text.
The first character in text has start-position = 1, and so on.
a If start-position is greater than the length of text, MID returns "" (empty
text).
o Ifstart-position .is less than the length of text, but start-position plus
number-of-chars exceeds the length of text, MID returns the characters
up to the end of text.
Microsofi Excel- Functions t"jl t" 49
o If start-position is less than 1, the MID$ function returns the #VALUE!
error value.
oIf number-of-chars is less than 1, the MIDfl function returns the #VALUE!
error value.
The following worksheet shows the results obtained for MIDfl function :

String Value Formula in ColC Result of Mid function


MUMBAI =M|D{AZ,3,31 MBA
3 MUMBAI =M!D{A3,1,3} MUM
4 MUMBAI =MID{A4 4 2} BA
PIANET =MID(A-5,2,31 IAN
6 TEtEVtStON =M!D(A6,5, l0l vrstoN
MOBITI =MID{A7,&a}
8 98690123d5 =MID(A& 6 3l lzl
FiS. 5.9 : Uslng UIDI) function to ertract charactcn from a *riag
To understand the use of this function, consider the string "MUMBAI". We
show below the position of each character in this string :

Characters M U M B A I
Position of character 1 2 3 4 5 6

il Formula =MID(A4, 4, 2) will pick up 2 characters starting from the 4tt


character, from the string given in cell A4
ii) In cell C7, we get the result as a blank string because the starting
position is given as 8, which is more than the length of the string.
iii) In cell C8, we get the result 123. This happens even if the characters in
the string are digits.
LEN
Purpose : Returns the number of characters in a text string.
Sgntax : LEN(text).
Tert : is the text whose length you want to find. Spaces count as
characters
Examples:
i) LEN('MAHARASHTRA") returns the value 11.
ii) LENf") returns the value O (null string).
is. also included in the length
iii) LEN('New Delhi") returns the value 9. Space
of the string.
iv) LEN(" Pune") returns the value 5, since there is a space at the beginning
of the word Pune.
UPPER
Purpose : Converts all lowercase letters in a text string to uppercase.
Sgntax : UPPER(text)
Examples:
i) UPPERfHistory") returns the value "HISTORY"-
ii) UPPER("commerce") returns the value "COMMERCE"
ii| UPPER("CoMmErCe") returns the result "COMMERCE"
50 n't't" Computer Sysfems and Applicattons - T'Y'B'Com"(Sem' VI)

iv) UPPER("ARTS") returns the value "ARTS" (no change if all alphabets are
already in capital case)
v) UPPER(A2) will return the value of the string in cell A2, converted to all
upper case
LOWER
Purpose : Converts all uppercase letters in a text string to lowercase.
Sgntax : LOWER(text)
Examples:
i)LOWERfHistory") rettrrns the value "history".
ii)
LOWER("COMMERCE") returns the result "commerce"
ii|
LOWER("CoMmErCe") returns the result "commerce"
iv) LOWER("arts") returns the value "arts" (no change if all alphabets are
already in lower case)
v) LOWER(A2) will return the value of the string in cell A2, converted to all
lower case
PROPER
hrpose : Capitalizes the first letter in a text string and any other letters in
text that follow any character other than a letter. Converts all
other letters to lowercase letters.
Sgntax : PROPER(text)
Examples :

il PROPER("this is an example") returns the string "This Is An Example".


The character "I" of the word "is" has been converted into a capital letter
since this "I" appears after a space. Similarly, character "a" (of "an"), and
character "e" (of "example") are also converted into upper case.
ii) PROPER('new delhi") returns the string "New Delhi"
ii! PROPER (mh-02-a-12p4) returns the result Mh-O2-A-12P4. Note that the
first alphabet "m" has been converted into upper (capital) case. Also, the
letter "a" which appears after the "-" s5rmbol has been converted into
upper case. Similar1y, the character "p" before the digit 4 has been
converted into upper case. Thus, the first character of the string is
converted into upper case, and then all characters that appear after a
non-letter character (such as -, a space, or a digit, etc.) are also converted
into upper case.
TRIM
Purpose : Removes all spaces from text except for single spaces between
words.
Sgntax : TRIM(text)
Example
TRIM("Cricket is a gentleman's game") returns the value "Cricket is a
gentleman's game".
FIXED
Purpose : Rounds a number to the specified number of decimals, formats
the number in decimal format using a period and commas, and
returns the result as text.
Sgntax : FIXED (number, decimals, no_commas)
Microsofi. Excel - Functions t'3;'g' 5l
Number is the number you want to round & convert to text.
Decimals is number of digits to the right of the decimar point.
No-commas is a logical value that, if TRUE, prevents FIXED from including
commas in the returned text.
Example
FIXED(1234.567, 1) returns 1,294.6
FIXED(- 1234.57, -1) returns -l,2go

I. State whether the following are tnre or fdse :


1. A function must not contain another function in its argument.
2. The functions UPPERfl and PROPERfl do the same thing in Excel.
3. The TRIMfl function removes ALL blank spaces from the string argument.
4. The LENfl function does not include spaces while calculating the length of a string.
5. AVERAGEIF function cannot ignore non-numerical data in a range while calculating
the average.
II. Multtple Cholce Questioas :
Select the most correct alteraative from amoag those given below :
1. Which of the following is the correct syntax for the COUNTIF function?
a) =COUNTIF(criteria, field_name, list_range)
b) =COUNTlF(criteria, field_range)
c) =COUNTIF(field_range, criteria)
d) =COUNTIF(list_range, field_name, criteria_range)
2. Which formula can add the all the numeric values in a range of cells, ignoring those
which are not numeric, and place the result in a different cell?
a) COUNTfl b) COUNTIF
c) SUM d) AVERAGEfl
3. Which of the following function(s) can be used to find a character starting from the
starting of a string argument?
a) =LEFTfl b) =MID()
c) either LEFTfl or MIDfl d) None of these
4. Which of the following function(s) can be used to find a character starting from the
end of a string argument?
a) =RIGHT() b) =MID()
c) either LEFTfl or MIDfl d) None of these
5. Values used with a function are called :

a) Arguments b)
parameters
c) variables d)
None of the above
6. A cell A1 contains the following data: MUMBAI-4OOO2O. We want to store the
PINCODE separately in another column, say column 81. Which of the following
functions is most appropriate?
a) LEF-T(A16) b) RIGHT(A1,6)
c) MID(AI, 8, 6) d) Either (b) or (c)
7. What is the purpose of the COUNTfl function?
a) It determines the number of cells in a range
b) It determines the number of empty cells in a range
c) It determines the number of lilled cells in a r€rnge .

d) It determines the number of columns in a range


S/T.Y.B.Com - Com. Sys. & Appl. (Sem. - V!
52 t't'l,' Computer Syslems and Applications - T.Y.B.Com.-(Sem' VI)

8. _ is tested in an IF() function to determine if it is tn-re or false


A(n)
a) Option b) formula
c) index d) condition
g. what will be the result according to this formula: = vLooKUP(Bl,
74
6rade
A4:88,21 2

a) A Grade Note
o E
b) B 60 D
c) c 5 7A C
80 B
d) D 7
90 A
i

lANsv.IERsl
I. [True:3
False z 1,2,4,51
III. [(1 -c), (2-c), (3-c), (4-al, (5-a), (6-d), (7 -cl, (8-d), (9-c)]

QUESTTOr{S
I. Write short answera :

1. What is a function?
2. What is meant by the retum ualue of. a function?
3. Explain, with s5rntax and examples, the LOOKUP function.
4. Explain, with syntax and examples, the VLOOKUP function.
5. Explain, with syntax and examples, the HLOOKUP function.
6. What is the difference between VLOOKUP and HLOOKUP functions?
7. Explain the use of IF function in Excel.
8. Explain the use of COUNTIF function in Excel.
9. Explain the use of SUMIF function in Excel.
10. Explain any three string (text) functions in Excel.
I 1. Explain the function that is used to extract characters from the beginning of a string.
12. Explain the function that is used to extract characters from the end of a string.
13. Explain the function that is used to extract characters from any position in a string.
14. Explain the UPPERfl and LOWER$ functions, with syntax and examples.
15. Explain the PROPERfl function. In what way is it different from UPPERfl and
LOWERfl tunctions?
16. Explain the difference between the following functions :
a) SUMfl and SUMIF$
b) VLLOKUPfl and HLooKUPfl
c) SUMIFfl and AVERAGEIFfl functions
17. With the help of an example, explain the use of nested IF statements.
U. What is the result of the following Excel functions?
1. =LEFT(',TYBCOM" 2)
2. =LEFT('TYBCOM', 10)
3. =LEFT('TYBCOM",0)
4. =LEFT("TYBCOM", -1)
5. =LEFT("TYBCOM", )
Microsofi Excel - Functions t?.,," 53
6. =RIGHT('TYBCOM',3)
7. =RIGHT("TYBCOM" )
8. =MID("MUMBAI",3,3)
9. =MID(',MUMBAI" 4,6)
10. =LEFT(A39) & MID(A39, to,l) & MID(A39, 22,t) if cell A39 contains coMpurER
SYSTEMS AND APPLICATIONS
11. =LEN("UNIVERSITY OF MUMBAI')
12. =LEN("")
13. =TRIM(" UNIVERSITY OF MUMBAI ')
14. =LEN(TRIM(' ABC "))
15. =LOWER('SUBURBS")
16. =UPPER("western railway")
17. =PROPER("western railway")
18. =FIXED(123.65, -2)
III. wrlte dowa the fuactlon to achleve each of the followiug taska :
1. To convert the first character of each word of "i love computers" to capital letter.
2. To convert the string "tybcom" into all capital letters.
3. To find the number of characters in the word "processor"
4. To remove all spaces from the beginning and end of the string "mobile phone".
5. To display the first three characters of the word "KEYBOARD".
6. To display the last five characters of the word "KEYBOARD".
7. To extract the characters "TEL" from the word "SATELLITE"
8. To count the number of cells in the range D1:D1o that contain numbers.
9. To count the number of students in the range D1o:D1oo securing "A" grade.

PRACTICAL EXERCISES
1. The following data has been entered in a worksheet.
A B c
I Name Pay DA
2 Bhavika 2100
I Priyanka 3000
4 Nikhil 4000
5 Namrata 1800
In cell C2, the formula =IF(B2*O.4 < 1OO0, B2*O.4, l00O) is entered. This formula is
copied to cells C3, C4, and C5. What values will be displayed in cells C2, C3, C4, and
C5? What will be the formula in cell C5?
2 The following data has been entered in a worksheet.

1 Name Test 1 Marks Test 2 Marks Total Marks Result


2 Jasmine 56 62
3 Deepa 49 53
* Anjali 76 7t
o Prerana 35 4l
Write function / formula in column D to grant total marks. If the final mark in
column D is greater than or equal to 90, the result should be shown as Pass in
column E, otherwise declare result as "ATKT".
3 A worksheet contains Name and Marks in three subjects namely, Ml, M2, and M3 in
rows 1 to 20. The first row contains the headings and the other rows contain data.
54 ,'t'!t' - T.Y.B.Com-(Sem. VI)
Computer Sgstem-s and Applications

Explain how to calculate the result in 8ft column. The result is declared on the
following basis : A student is declared as pass if he gets 4O or more marks in each
subject, or the average of the marks is 5O or more. Otherwise he is declared as Fail.
4 In the following worksheet enter the values in column B corresponding to formulas
given in column A.
A B
I India is a great country
2 =LEFT(AI,5)
=RIGHT(AI,7)
=MID(A1, 12, 5)
=UPPER(A1)
5. The marks in six subjects of students is shown in the table below. Calculate the total
marks obtained by each student in all the six subjects, and percentage of marks (up
to 2 decimal places). If total marks obtained by a student is greater than or equal to
240, RESULT is PASS else RESULT is FAIL. Also print the highest aggregate marks
obtained.
A B c D E r G H I J
1 Name English Hindi Eco BK Maths Acc. Total Pctg Result
2 Anjali 76 63 78 66 68 86
3 Rajesh 54 49 48 52 46 59
4 Prerana 72 69 66 78 75 81
t, Jasmine 87 73 84 82 91 93
a Mumtaz 54 49 28 31 17 21
7 Highest Aggregate Marks
Also compute the average marks in each subject, excluding
absent scores, ifany.
500
These averages for each subject should appear in row 8.
6. In the above example, create one more column (K) which will
compute the grade of each student, by using nested if 300 - 359
statements. Grade is calculated as per the following table : F < 3fi0

t't'lr'
Aduance d Mbrosofi Excel-Functions
t't,"t' 55

ODULE III
DVANCED MS-EXCE

Ado anced Micros oft E xcel


Functions

SOME MORE FUNCTIONS IN EXCEL


We have already studied a few functions in Excel in previous chapter. In this
chapter we study a few more functions that are extremely useful for commercial
applications. At the end of this chapter, you will be able to :
o Use functions for working with date and time.
o Use statistical functions.
DATE & TIME FUNCTIONS
Excel treats date and time as numbers. Excel provides many functions
dealing with date and time. Let us see some of these functions :
TODAY
Purpose : Returns the current date (i.e., system date)
Sgntax : TODAY( )

Arguments : None
Example : = TODAY( ), (in mm/dd lyyW format)
Output : 10/15/2013 (Assume this is today's date, as per the
computer system)
Example ' =TODAYfl+1
Output : 10116/2013
Example : =TODAY()-7
Output : 1.O/8/2O13
NOW
htrpose : Returns the current date and time
Sgntax : NOW o
Arguments : None
Example : = NOWO,
Output : 1O/l5l2ol3 Ll:23
DATE
Purpose : Displays a date based on its three arguments.
Sgntax : DATE(Year, month, day)
56 t"9't. - T.Y.B.Com.-(Sem. VI)
Computer Systems and Applications

Example : = DATE(2013,10,04), will display the date as octobet 4,2OL3


or 4-Oct-2013, depending on the cell formatting'
Example : = DATE(2O13,23,251
Output : lll21l2Ola
Since we have put month as 23, it will be treated as month 11 of nextyear'
(23 = 17 +L2l
TIME
httpose : Returns the particular time in hh:mm AM/PM form'
Sgntax : TIME(hours, minutes, seconds).
Example : =TIME(15, 12,35)
Output : 3:12 PM
Example : =TIME(25,0,O)
Output : 1:OO AM
Since we have given hours as 25, it will be converted as follows :25 - 24 = I
DAY
Purpose : Returns the day of the month for a date. This will be a value
between 1 and 31
Sgntax : DAY(serial number).
Example : =DAY("3 I L l20 13") returns the value 3.
Example : =DAY(TODAYfl) will return, for example, 25, if today's date is
Oct 25, 2Ol3
WEEKDAY
hrpose : Returns the day of the week for a date.
Sgntax : WEEKDAY(date, return-type)
Return-type is a number that determines the type of return value
Returns tgpe number returned
1 or omitted number 1 (Sunday) through 7(Saturday)
2 number 1 (Monday) through 7(Sunday)
3 number 0 (Monday) through 6(Sunday)
Examples: (assuming dd/mm /VyW format)
= WEEKDAY('l2l70/2013", 1) will display 7 (Saturday)
If you get the error message #VALUE!, it means that the system is set for
dd/mm/yyyy format but you have entered the date in mmlddlyyyy format.
DAYSS6O
Purpose : Returns the number of days between two dates based on a
360-day year (twelve 30-day months), which is used in some
accounting calculations.
Sgntox : DAYS360(start_date, end_date, method). Usually, the
argument for method can be omitted.
Example : =DAYS360(1/ | / 1990" , "l /l /2OOO") returns the value 3600
Example : =DAYS36O("O1/O1 l2}l3", "25/lO/2O13") returns the value
294
MONTH
hnpose : Returns the month corresponding to the date
Sgntax : MONTH(date)
Aduanced Microsofi. Excel-Functions lr't'31, 57
Example : =MONTH("3/412O13") returns the value 4 corresponding to
the 4ti,month (April).
Example : =MONTH("08-JULY-1960") returns the value 7 corresponding
to the month of July.
YEAR
h.ttpose : Returns the year corresponding to serial number or data text.
The year is given as an integer.
Sgntax : YEAR(seri"l_number)
Examples :
= YEAR("\2I25I2013") will display 2Ol3
= YEAR(TODAY0) will display 2Ol3 if today's date is 25-Oct-2013

STATISTICAL FUNCTIONS
Name
COUNTA Amita
Pooje
Purpose : This function counts the number of cells that are
not empty and the values within the list of sneha
arguments. It is used to count the number of cells Prerana
that contain data in a range
Deepa
Sgntctx : COUNTA (value1,value2,...). Here, value, voh)e2.,,, Maniu
are values that we want to count.
Examples : Consider part of a worksheet as shown below: Geeta

In cell A15, we have used the formula =COUNTA(A2:A14). This Seema


returns the value 8 as there are 8 non-empty cells in the range
a
A2.,}.14.
Fig.6.1 :

Name
COUNTBLANK Amita
htrpose : This function counts the number of Pooia
Blank cell
empty cells within a range. sneha
Sgntax : COUNTBLANK(range). Prerana
Blank cell
Examples : Consider part of a worksheet as
shown below: Maniu
In cell A16, we have used the formula Blank cell
=COUNTBLANK(A2:A14). This returns the value 6eeta
Blank cell
5 as there are 5 non-erripty cells in the range Seema
A2:A74. Blank cell
a
5
Fig.6.2
CORREL
Htrpose This function returns the correlation coefficient of two ranges.
Use the correlation coefficient to determine the relationship
between two properties.
Sgntax C O RRE L(a r r ay l, arr ay2l

Arrayl is a range of values.


Array2 is another range of values.
Examples Consider part of a worksheet as shown below :
58 t?'r't' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

E tr
1 D*tat Data2
2 9
3 7
4 t2
15
6 t7
7
o.98703r coefficient of the two data sets above
Fig.6.3
Cell A8 contains the formula =CORREL(A2:A6, 82:86). The result of this is
shown in cellA8.
LARGE
Purpose ; This function returns the k-th largest value in a data set. This
function can be used to select the first, second, third, or say, the
10th position in a list of
numbers. mrlsictD
1 Datal
Sgntax : LARGE (array, k)
Examples : Consider part of a worksheet
4
as shown below:
5
Cells A2 to A9 contain the data. In cell A1O,
we have used the formula =LARGE(A2:A9, Ll. 7
This returns the largest value (1 = "first', i.e.
maximum value) in the range. In cell A11, the 2t no
formula is =LARGE(A2:A9,2); this returns the 11 Second
value 16 as it is the second largest number. Fourth no
Can you guess what formula is used in cell
At2? rtg.6.4
Remember, in the formula, k should always be greater than zero.
S}IALL A B]C D

Purpose ; This function returns the k-th 2


Datal

smallest value in a data set.


Sgntax ; SMALL (array, k) 4

Examples : Consider part of a worksheet as


shown below: 7
Cell A10 has the formula =SMALL(A2:A9, L). I
It returns the smallest number in the range
A2:A9. Cell Al l contains the formula Smallest no
Second smallest no
=SMALL(A2:A9, 2l and it glves the second
11
guess the formula
srnallest number. Can you guess what formula is
used in cell A12? rig.6.5

OBJECTTVE
I. State whether the followlng are tnre or false :
1. NOWfl function returns.only the current system time.
2. WEEKDAYfl returns the day of the week such as "Sun,, "Mon", etc
3. COUNTA and COUNTBLANK functions applied over a range, will always return the
same value.
Dxcel-hnctions
Aduanced Microsofi t"r.jo Sg
4. The Stt' largest number in a range is obtained by using the formula =LARGE"
. (array, 5).
5. The largest number in a range of 10 numbers can be obtained by using the formula
=SMALL(array, 10)
U. Uulttple Choicc Qucrtloan
Sclect thc mort eppropd.tc dteraetlvc from anoagst those given aad rewrlte
tbe acatencc :
1. The _ function obtains its time and date from the computer's clock :
a) ToDAYfl b) Nowfl
c) CURRENTfl, d) DAYS3600 ,
2. The function gives tJre correlation between two sets of values:
a) I-ARGEfl
- b) COUNTA$
c) COUNTBLANKfl, d) CORRELfl
3. In a range consisting of 1O numbers, which of these formula will return the Sth
largest number?
a) LARGE (A1:A5, 5) b) LARGE (A5:A10, 5)
c) I.ARGE (A1:A10, 5) d) LARGE (5, AI:A1O)
4. In a range consisting of 1O numbers, which of these formula will return the largest
number?
a) SMALL (A1:A10, 1) b) SMALL (A1:A10, 10)
c) SMALL (1, A1:A1O) d) SMALL (lO, A1:A1O)
ANSWERS
I. [Tnre:4, 5
Ealse:1, 2,31
il. [(1 - b), (2 - d), (3 - c), (a - b)l

QUESTIONS
III. Wrlte rhott enltGts :
l. Explain the DATE function in Excel.
2. Explain the DAYS36O function in Excel.
3. Explain the diflierence between TODAY$ and NOW$ tunctions.
4. Explain the dilference between the following functions :
a) Now0 and TIME0
b) DAY$andWEEKDAY$
c) COUNTA$ and COUNTBLANK$
d) LARGE$ andSMALL$
fV. What ls the rerult of the followtag Excel functloas?
l. =DAY("8 JULY')
2. =DAY("8-7-2ol4"l
3. =MONTH("8 JULY'r)
4. =TIME(15,45,1O)
5. =TIME(15,45,)
6. =WEEKDAY("8-JULY-2014')
7. =YEAR("8-JULY-2O14")
8. =DAYS36O("12-OCT-2O13','30-OCT-2O14")
V. Wrlte dosn the fuaetloa to echleve each of the foltowlng tasks :
1. To find the current date.
2. To Iind the current system date and time
3. To find the weekday of26trt January 2OL4.
60 t'r't' Computer Sgstems and Applbations - T.Y.B.Com.-(Sem. VI)

4. To find the 3td largest number in the range B4:.B2O


5. To find the largest number in the range C2:C2O, by using the SMALL$ function.

PRACTICAL EXERCISES
1 The dates of births of five employees in an organisation is given the following table.
Write appropriate formula to compute the number of completed years, months and
days (as of today) in columns C, D, and E respectively.
A B c D E
1 Name DOB Years Months Days
2 Aishwalya o2-o4-1975
3 Rajesh t6-o3-t977
4 Prerana 15-O1-1992
5 Jasmine 23-O8-1980
2. For the following set of data, find the largest value in column A, smallest value in
column B and the coeflicient of correlation between the values in columns A and B.
A B
I Datal Dsta2
2 19
3 12 z
4 L7 72
5 L8 15
5 9 1
7 15 7
I 13 5
I 16 9

t?'t'
Microsofi Excel Data Analgsis lt't'l,' 61

7 Microsoft Dxcel
Data Analysis

FILTERING DATA
Filtering a list means hiding alt the rows except those that satisfg a particular
condition. For example, if you have a list of qtudents, do1rg with their percentages
and result (pass/fail), you can filter the data to show only those who have passed
the examination.
Excel provides two ways of filtering data :
o AutoFilter, for quick and simple filtering
o Advance Filter, for more complex filtering.
AutoFilter
In the following example, we will first see how to use the AutoFiltering
feature, which, for most problems is sufficient.
The table below shows a list of names of students, along with their
percentages and Result.
We wish to filter the list so as to view only the results of those who have
passed in the examination.
A B c
Name Percent6ge Result
Anita 69 Pass
Shweta 7? Pass
Mansa a2 Pass
Roopsl 53 Pars
6 Jiten 32 Fail
7 Deep 37 Fail
I Firdaus 40 Pass
61 Psss
E Fail
67 Pass
W.7.2: Fllter buttoa
Fig. 7.1 : Uallltered List
lodAtoZ
Sq*ZtoA
B SoG 5t Colot
I ,Narne tr Percentageffi Resukf !lE# rat$ Fr6fl!'gelait'

2 Anita 69 Pass T.d EBt.B


3 5l:weta 73 Pass : E Gel€ct Al)
NFJ
r...gir8B
Mansi 82 Pass
; lnoopal EA Pass
t lrirdaus 40 Pass
I llteeta 61 Pass
irle itan.lali 67 Pass I--6'-:l f- q"t"ql
d?
Fig. 7.3 : After Applying Filter Flg.7.4: Filter Dialog Bor

\
62 jl"3?' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

To AutoFilter the list :


1. Click anywhere in the data.
2. In the Home menu, click on Sort & Filter button in Editing tab (Fig. 7.2).
3. In the menu that appears, select Filter. Arrows appear against each column
heading, as shown in Fig. 7.3.
4. Click on the arrow in the Results column. The Filter Dialog box shown in
Fig. 7.4 appears.
5. Under Text Filters, remove the check mark from Fail. A check mark will be
shown only against Pass.
6. The list is filtered and only shows the rows for those whose result is "Pass".
7. To remove the filter and show all rows, again click on the Sort & Filter button
in the Ribbon, and click on Filter.
Shortcut to Auto-Filter a list :
1. Click anywhere in the list.
2. Press CTRL + SHIF"T + L keys
3. The arrows appear against each row heading.
4. Click on the arrow in the Results column. The Filter Dialog box shown in
Fig. 7.4 appears.
5. Under Text Filters, remove the check mark from Fail. A check mark will be
shown only against Pass.
6. The list is filtered and only shows the rows for those whose result is "Pass"
7. To remove the filter and show all rows, again press CTRL + SHIFT + L.
Example:
The worksheet shown in Fig. 7.5 below is to be filtered so as to show only
those students'data whose na.mes begin with M.
,tS -@
u----;--
I lxame F perentalil ResuL:
lt
B
zt Sort A to Z
at
A' Sart Z to A
1 Name Result SoC bt Color
2 69 Pass {{ gtenr Fili{r Fom -Nime"
Fjll€r by {otst I
3 v3 Pass
Eq{.|i...
4 Mansi a2 Pass
g (sd.ct Ar) Do.r Xot Eqs3...
i
5 53 Pass 'ElLit
: ElDc.p
6 ?2 Fail I
:.gFidaE End. W!h.,.
I
: .gclt!.r.. Co[tains,,,
7 Deep 37 Fail ,-.9 .Illn
Poca ilotao.*rtn...
Firdaus /t0 Pass EtEd
i EraayuEt! Custon Eilte,...
Neeta 61 Pass :..gr.te.b
gRoop,
Mayu 29 Fail 1

11 67 . P?rs,
f- s *l l" -t r!.!t -l
Fig. 7.5 : Unllltered , List fig. 7.6 : Tert Filter Dldog Bor
Custonl AutoFiltet 7ilE
N6re - ...

begins with

Oq
A I

I Name Resul[i
Mansi 8Z
f**i;K-'l f cq.d -l Pass
29 Fai!

i19.7.7 : Custom Auto-Fllter Dlalog Bor Ftg. 7.E : Elltercd Llat (ltrrt letter M in namc!

I
Microsofi Excel Data Analgsis g?'t'' 63
To Fllter the List :
1. Click anywhere in the list.
2. Press CTRL + SHIFT + L
3. Click on the drop-down arrow that appears in the Name column.
4. Click on Text Filter and select "Begins With..." The Custom AutoFilter dialog
box shown in Fig. 7.7 appears.
5. In the Name begins with, type M, and press OK. The following filtered list
appears; it shows only those students' data whose nzunes begin with 'M'.
(Fig. 7.8).
GRAPHICAL REPRESENTATION OF DATA
Excel's formatting and data interpretation features are extensive. However,
data is often better displayed in a graphical form. One of the most important
features that Excel has incorporated its ability to create'charts and graphs. This
chapter discusses how to create and edit graphs in Excel. At the end of this
chapter, you should be able to :
o Identify the various parts of a chart.
o Identiff different types of charts.
o Create charts from the data.
o Modify the charts.
OVERVIEW OF CHARTS
Charts can be said to be a graphical representation of the numerical data
that can be seen on a worksheet. Just as a pidure is utorth a thousand words,
similarly, a chart can bring out the salient features of data in a worksheet. It is a
sort of "at-a-glance" to the vast amount of numeric data. Data displayed on a
chart is more easily understood. A chart helps us to spot trends and patterns
uthichutould be nearlg impossible to identifg in a range of numbers.
Placing the chatt
When a new chart is created, it can either be inserted directly into the
worksheet (embedded chnrt) or it can be on a new chart sheet in your workbook.
A chart sheet is different from a worksheet in that it can hold a single chart, and
it does not have cells.
Chatt IYpes
Excel offers many chart types. These are: column chart, bar chart, line chart,
pie chart, XY chart (scatter), area chart, doughnut chart, radar chart, surface
chart, bubble chart, stock chart, cone, pyramid and cylinder charts. We will be
studying in detail only the column, bar, line, and pie charts.
Whieh Chaft type to use?
Since Excel offers so many different types of charts, the question that arises
is which chart type is suitable for a given set of data. Try different chart d4pes,
and use the one that puts the message across unambiguously.
Let us see the salient features of different chart t5pes :
1. Column Chart : A column chart shows data changes over a period of time or
illustrates comparisons among items. Categories are organised horizontally,
and values vertically, to emphasize the variation over time.
2. Bar Chart : A bar chart illustrates comparisons among individual items.
Categories are organized vertically, values horizontally, to focus on
comparing values and to place less emphasis on time.
64 t"t'j" Computer Systems andApplications-T.Y.B.Com.-(Sem. VI)

3. Stacked bar charts show the relationship of individual items to the whole.
4. Llne Chart : A line chart shows trends in data at equal intervals.
5. XY Chart : An XY chart either shows the relationships among the numeric
values in several data series or plots two groups of numbers as one series of
riy coordinates. It is commonly used for scientific data, such as variation of
temperature with time.
6. Ple Chart : This chart shows the proportional size of items that make up a
data series to the sum of the items. It always shows one data series; it is
used to emphasize a significant element.
CREATING SIMPLE CHARTS
Creatlng a Column Chatt
t Sal€ of

4
Sublect
Accounts
Taxation
Mumbai
247A
27!n
Pune
2W
2t7t
Nagpur
2388
aJ71
I
gsk
6 BUs. LarU 2893 27:t2 1905 Column lins Pie Bar Area scatter Other
7 Total 8161 75*' Glm

Flg. 7.9 : Sample wortshect Flg. 7.1O : Cbail Typee ln Ercel 2OO7
The following worksheet shows the number of books of different subjects,
sold in three cities Mumbai, hrne and Nagpur :
Step I : Create the Basic Chart:
We create a basic chart based on this data as follows :
1. Select the range A3 : D6. This can be done by either of the following ways :
a) Click on cell A3. Keep the SHIFT key pressed and click on the diagonally
opposite cellD6. The complete range is highlighted.
b) Press the function key F5. In te GoTo dialog box that'pops up, in the
reference text box, type A3:D6. The entire range is highlighted.
2. Click on Insert tab.
3. In the ribbon, click on Column button in Charts group. (Fig. 7.I0)
4. various chart types are shown. select the first option, i.e., 2D column )
Clustered Column.(Fig. 7.11). Excel ceates a Clustered Column chart and the
Chart Tools context tabs appear.
5. The basic chart created by Excel is shown below (Fig. 7.12) :
35{X'

300

2t0J

am IAc<ounts
15{X' I Tilatbn
S Bus. Le
tqx,
5tx,

tE[ H[ o
Mumbai Fune laigpur

Fig. 7.11 : Selecting 2D Columa Chatt DlS.7.l2: Baslc 2D Cluetered Column Chaft
Microsofi, Excel Data Analgsis t"3l";1" 65
Step II : Apply a Chart Layout :
Once the basic chart is created, we can change the chart layout and display
the chart tifle, legend, axes labe1s, etc.
l. Click the chart as shown in Fig. 7.12 above. The Chart Tools becomes
available on top of the Excel menu.
2. Choose the Design tab.
3. Click the Chart Layout button in the Chart Layout goup. (Fig. 7.13)
4. Click layout 5. Excel applies the layout to the chart. (Fig. 7.1a)

Title

I! I
J

Mumbai Puna l{aipur


lAc(ount! 2474 2540 2348
! Tdltion 2790 2173 2077
Chart Layoutr I aJi- Lil 2893 2722 1905

Ftg. 7.13 : Chart Layoutr DiS.7.l4: Chatt rlth deta at botton


Step III : Add Labels :
1. Select Chart Title. Click on Chart Title and then type SaIe of Books. Excel
adds your title.
2. Select Axis Title. Click on Axis Title. Tlpe Quantity. Excel labels the axis.
3. Click anywhere on the chart to end your entry.
4. The final chart created is shown in Fig. 7.15 below :
Sale of Books
35m
3fito

-
!
2500
2(xx)
I
I--
a
150(}
6
10@
500
0
Mumbai Punc l&pur
IA€counts 2478 2&A 2388
I Tildtion 2790 2173 2077
I Bus. law 2893 2?22 19(,5

Fig. 7.15 : Fiaal Chart after labeliag


Switching Data
We can switch from row data to column data and vice-versa to change how
data is displayed in the chart. For example, to display the subjects along the
X - axis, we can switch rows and columns as follows :
1. Click your chart. The Chart Tools become available.
2. Choose the Design tab.
3 Click the Switch Row/Column button in the Data group. Excel changes the
data in your chart. (Fig. 7.16)
66 ,",'t' Computer System.s and Applications - T.Y.B.Com.-(Sem. VI)

Chart Title
Gridline Sale of Books
35aX' Plot Area
:xx,o
2500
u 2(m
Axis Title E
it 1900 Selection Box
1(m

Value Axis
A{cqnb + Tu&a E{8. Lt
a Mumb.i 2414 279' 2895
Legend lPun€ 2go 2173 2722
: Nngpur 238r m77 lgr5

Category &ris

Fig. 7.16 : Srltchlng Rosr"ead Coluaan ead Elcnentr of e Chatt

ELEMENTS OF A CHART
Before we discuss charting in further detail, let us see the different elements
of a chart. Different types of charts have difrerent elements - for example, pie
charts do not have axes, and only 3D charts have walls and floors. (FiS. 7.281
The various chart elements are described below :
1. Gridllne : These are lines you can add to a chart that make it easier to view
and evaluate data.
2. l*gerrd : It is a box that identifies the patterns or colors assigned to the data
series or categories in a chart.
3. Plot Area : The area where the actual chart is plotted, excluding the legend.
4. Title : The chart's title.
5. Data Serles : It is a group of related data points plotted in a chart that
originate a from rows or columns on a single worksheet. Each data series in a
chart has a unique colour or pattern. You can plot one or more data series in
a chart.
6. X-Arls : This is called the "Category axis". This axis represents the different
categories that are plotted on chart.
7. Value Arls or Y-aris : This represents t}re ualues of data points.
8. Category Names : The names are taken from the topmost row or leftmost
column of the worksheet.
9. Data Markers : It is a bar, a dot, or some other symbol in a chart that
represents a single value that originates from a worksheet cell.
10. Tick Marks : These are small lines of measurement that intersect an axis,
similar to divisions on a ruler.
MANIPULATING THE CHART
An Excel chart can be moved, changed in size, deleted, etc.
1. Changing the chart slze : To change the size of a chart, click on the chart to
select it. Small selection boxes appear on each corner of the chart. Drag one
of the selection handles to make the chart larger or smaller.
2. Movlng the chart : To move the chart, press the mouse on the border of the
chart and drag the mouse.
Analysis
Miirosofi Exrel Data t'jPt' 67
3. Deleting a chart : Select the chart and press Delete or Backspace to delete
it.
4. Changlng charted date : Charts are linkla to the selected data. Whenever
the data changes, the chart adjusts to reflect those changes.
EXCEL'S CHART TYPES
Having studied the fundamentals of charting through Excel, let us now draw
different types of charts. The column chart has already been covered earlier in
this chapter.
BAR' CHART
A bar clurt rls essentiallg a column chart ttnt hns been rotated bg 90 degrees.
The advantage of using a bar chart is that the category labe1s may be easier to
read. Bar charts can consist of any number of data series.
Exanple:
The following table shows the loans disbursed to individuals by a housing
finance company. Plot a bar chart for the data. (Rupees in crores)

LoansDisbursed

zfii{g
a

C
t I*rie51
B I 20da{t8 840
I-
Loans Oisbursed I
2006€7

2{t(K$7 2ffi7J08 u{xl&J}g o 2(x) 4{n 6m 80(} 1000 12m

rt ?TO 84S 1000 Arrgxt tr Ciqts

W.7.17 : Ilata of Loans Dlcbuncd Fig. 7.f8 : Bar Chart

Steps to Create a Bar Chart :


l. Select the data region A3:C4. You must include the labels also while plotting
a chart.rExcel uses the labels for legend and axis information. The labels in
this example are the values contained in cells A3, 83, and C3.
2. Click on Insert.
3. In the Chart group, click on Bar and select 2D Clustered Bar. The basic chart
is created.
4. In the Chart Tools, click on Design tab.
5. From the Chart Layouts grouP, select the first type Layout 1'
6. In the chart, click on the chart Title and type Loans Disbursed.
7. In the Chart Tools, click on Layout.
8. In the Labels group, click on Axis Title ) Primary Horizontal Axis Title )
Title Below Axis
g. Excel shows the following below the X axis: Axis Title. Change this to Amount
(in Crores).
10. In the Labels group, click on Data Labels ) Outside End. The values are
shown on the graPh.
6ff.Y.B.Com - Com. Sys. & Appl. (Sem: - VI)
68 l,'t?' Computer Sysfems and Applications - T'Y'B'Com'-(Sem' VI)
11 Labels group, click on Axis Title )
In the Primary Vertical Axis Title )
Rotated Title.
12. Excel shows the following near the Y axis: Axis Title. Change this to :
Financial Year.
The is shown in 7.r8
PIE CHART
A Pie chart is the onlg c?nrt tgpe tlnt can di.splag onlg one data series. This
type of chart is useful when You want to show the relative proportions or
contributions to a whole. Generally, a pie chart should use not more than five or
'

six data points; otherwise it's difficult to interpret.


Example :
Consider the table shown below which shows the shareholding pattern by
various institutions, in a housing finance company.
Shareholding Pattern
O*rers

Lrc
3896

Sub:idiaries
c D E 1296
1 Shareholding Pattern by Various lnstitutions
2
3 UC
4 38% 12% 15% 12% 23o/a 15}6 Lzy6

Fig. 7.19 : Data to plot a Ple Chart Ftg. 7.2O : Pie Chart
Steps to plot a Pie Chart
1. Select the data in the range A3: E4.
2. Click on Insert.
3. In the Chart group, click on Pie and select 2D Pie. The basic chart is created
4. In the Chart Tools, click on Design tab.
5. From the Chart Layouts group, select the first type Layout 1.
6. In the chart, click on the Chart Title and type Shareholding Pattern.
7. In the Chart Tools, click on Layout.
8. In the Labels group, click on Data Labels ) Outside End.
The completed graph is shown in Fig. 20.
LINE CHART
Line charts are very common. They are frequently used to plot data that is
continuous rather than discrete. For example, plotting daily price of a share or a
mutual fund may let you spot trends over time.
Example:
Consider the table shown below which shows the daily rainfall in two towns
for a twelve month period. We have to plot a line chart for the data in this table.

Daily Rainfall {in mm)

Jan Feb Mar Jun Jul Aug Sep Oct Nov Dec
TownA 25 11 1S 10 331
Torn B 5 78 19 21 15 11

Flg. 7.2L : Data for plottlag a Llne Chatt


Microsofi Excel Data Analysis t?,t' 69
Steps to plot a Line Chart
1. Select the data in the range A3: M5.
2. Click on Insert.
3. In the Chart gfoup, click on Line and select the first option Line. The basic
chart is created.
4. In the Chart Tools, click on Design tab.
5. From the Chart Layouts group, select the first type Layout 1.
6. In the chart, click on the Chart Title and type Daily (Average) Rainfall. This
becomes the chart title.
7. Click on the Y axis and type (in mm)
8. Click on Layout ) Axes group and select Gridlines.
9. Click on Primary Vertical Gridlines ) Major Gridlines.
The final chart is as shown in Fig. 7.22 below :

Daily {Average} Rainfall


25

20
\
{
\ lr
?15 /\ \
E / / \ \
€ro
\ -TownA B
5
/ \ \ -Tosnl
,/
0
J.n hb Mlr Apr Mry Jun Jul Aui 5.p Oct tla. O.c
Fig.7.22: Llae Chart
GUIDELINES FOR PLOTTING CHARTS
Excel has excellent charting capabilities, and all these cannot be covered in
this text book for lack of space. The interested student is encouraged to
experiment with different types of charts for a particular data. Here are a few
guidelines for plotting charts.
1. Are the data that you want to plot in two rows of the table or in two
columns?
If the data are in columns, select two columns for plotting :
O if the columns to be plotted are not adJacent to one another, you must
click on the top of the first column on the letter of that column (for
example, column A, or B, etc). Then press the CTRL key and click on the
top of the second column on the letter of that column.
O if the columns to be plotted are adjacent to one another, you must click
on the top of the first column on the number of that column. Then press
SHIFT key and click on the top cf the adjacent column on that column's
number.
If the data are in rows, select two rows for plotting :
O if the rows to be plotted are not adjacent to one another, you must click
on the left of the first row on the number of that column. Then press the
CTRL key and click on the left of the second row on the number of that
row.
70 t"r'jl' - T.Y.B.Com-(Sem. VI)
Computer Systems and Applications

O if the rows to be plotted are adJaceat to one another, you must click on
the left of the first row on the number of that row. Then press SHIFT key
and click on the left of the adjacent row on that column's number
2. Excel offers many different types of charts. Use the one which makes the
values of your table easily understood. Don't use an esoteric chart type just
because it is there!
3. If you have constructed a chart, you can easily edlt any element of the chart
by double-clicking the element. A dialog box relevant to that element will open
up, and you can make changes to it.
USING SCENARIOS. CREATING AND MANAGING A SCENARIO
Scenarios are part of a group of commands sometimes callpd what-if
analysis (what-if analysis is a process of changing the values in cells to see how
those changes affect the outcome of formulas on the worksheet). A Scenario is a
group of values that give different results when involved in a calculation. They are
widely used in budgeting to determine how change in values e.g. increase
expense on raw material will affect the overall future budgei of the company. The
Scenario Manager can be used to put different values in and generate different
budgets for each set of values. The Scenario Manager is available in the Data Tab
under What-If Analysis.

Data Review View

,*im;r
.l{ i 5o* nter
:#F3
Text t6 RemoPc
ffi Data
.p advanceo Columns Dupli(ntes V;lidation -

F H, .J lt Oata Iable.,,

Flg.7.232 Scerados ln Data) Ehet-tf-Aaalysts


Scenario Maruger .,....1*.*

li rdd^-. . il

f.wr...I

(}tllUilgidr:
CaElt€rb

f.,, ;
w.7.24
This is where the scenario can be created. By clicking on Add we can give the
scenario a name e.g. Budget, then enter the cells range which contain the values
e.g. A5:A15 that can be changed to produce different stenarios.
Microsoft Excel Data Analgsis
t'r?' 71

Scrbqane:
BrdgEt

dffigirry!ds"
CgnrylEnL
Created by Faiyaz m 18115l|S 14

ProEctftm

Mnrellern*ange
tsr*
fl( ,,,',,,;{crd

Then click ok to finish c.eatin[tst*''3".rr".io. subsequently the scenario


.Manager can save this scenario in a preset report format in a different worksheet.
The Sheet is automatically given the name 'scenario Summary'by Excel and
formatting is applied to the data.
Erample:
Consider the following worksheet containing the amount spent for various
items during the year.
A B C D
1 Items Costs
2 Machinery 60000
3 Carriage 8000
4 Transport 30000
5 Office equipment 6000
6 Postage 7000
7 Miscellaneous 3000
8 Generator 5000
9 Total 1 19000

10
Prepare scenarios where there is an increase as follows :
0 Machinery increases to 80,000, Carriage increases to 9O0O and Postage
increases to 8000
ii) Carriage increases to 10000, office equipment increases to 7000 and
Postage increases to 90O0.
Solution :
1. From Data Tab select What-If Analysis and then select Scenario Manager.
2. Click on Add in the scenario manager and in the scenario dialog box type
Current Expenses.
3. In the changing cells type B2:B8 and click on ok.
4. Again click on Add in the scenario manager and in the scenario dialog box
type Increase in Machinery and Carriage and click on ok.
72r'r?.ComputerSystemsandApplications_T.Y.B.Com.y'Sem.W)
S. In the scenario values dialog box ffie in Machinery Text box $B$2 type
80000
6. In the carriage box $B$3 type 9OOO.
7. In the Postage box, $8$6 type SOOO and click on ok
8. Again click on Add in the scenario manager and in the scenario dialog box
type Increase in carriage and office equipment and click on ok.
9. In the carriage box $B$3 type 1OOOO.
1O. In the office equipment box $B$5 type 7OOO.
1 L. In the Postage $B$6 9OOO and click on ok.

&..
Q*!
E*r,.

Ulrnr.,,
ql'trrry,,.

chmfigc*&r 18$2:18*8
Cqtlnrrltr fdt olL9rs1{

$o{ {lm

w.7.26
L2. In the Scenarid manager dialog box click on Summar5r
13. In the Scenario Summar5r dialog box select Scenario Summary, t5pe 89 in
the result cell and click on 6k.
14. The Scenarios are displayed on a new Scenario Summary Worksheet.
15. Select A1:A8 and select copy.
16. Select A5 in the scenario summary and click Paste. The following scenario is
obtained.

c 0 T T

Inilta5r!n (ar;ag! rnd off:(etq

ffi
rm $il
sfi|0 3sm
60m 6m
Im sm
s lmo

t0te!: CulrelrlVdGrdunn reffrsm$rdr*loldnqi{elhd


trEs.enilh tummr? Rrfortrxae*d, @ryclkfwedr
ffi rlo rr. hlghl$trd ln grry,

D19.7.27
Microsofi Excel Data Analgsis t'0't' 73

GOAL SEEK
Using known values we can perform calculations using Formulas and
functions to obtain the required answer. This is very common and we have used
it in several examples. However, sometimes we may know the answer (goal), but
we do not know the value to be used in the formula to achieve this goal. Goal
Seek option is available in the Data Tab under What-If analysis.

Dtta

h
ffit
$
;iHE
*oaio*
Propertie:

Edit LinkE
f,
x I iaizt
z
A
lzlrl
I
-
Sort
Y y:*'
tl
m.r -
Keappry

Irfikt(r€
BE.E H
Ttrtto Rrlrwr lldi
Cohmar Duplicdts Vrltuldion.
*
(onsoliddr
qH qH
Group Ungroup Subtoti
Bffi

{or*cdior* 9o* Data Tooll


Sccndio lilanagcr.,.

@lSccl..
tla$ISle,,,
C

Fig.7,2a: Data ) What-if-Analysis)Goal Seek


For example, let us suppose that we need to
save t 5,00,000 for our child's education which will
be required in 6 years' time from now. Hence we p
know the goal that we want to achieve. What is tffi
required to be determined is the amount that To &rhel

should be saved each month so that this goal can Eygl*rghgrCr IE


be met. The Goal Seek feature can help find this CK Catcd
amount. Hence it comes under the '\Mhat-If
Analysis'option in Excel and is referred to as the
What -If analysis tool. PV.7.29
The Goal Seek dialog box is shown in the above figure which is in the Data
Tab, under the Data Tools group. In the Set cell box, the address of the cell that
contains the formula is entered. This enables Excel to know the formula that has
to be used in the calculation. In the to value box, the desired required amount
that has to be collected. In the by changing ceII box the address of the cell in
which we want the answer to appear is entered.
Example:
Consider the following worksheet
A B c
1 Cost Centers Amount in 2Ol4 Amount in 2O2O
2 Fees 200000
3 Hostel Charges 15000
4 Food & Clothing 25000
5 Miscellaneous 10000
6 Total Amount required
7
8
Fig.7.3O
In the above worksheet the costs involved for education in 2014 under four
categories is given. Calculate the Amounts required in 2O2O taking into account
increase in fees by 5Oo/o, Hostel charges by 25o/o, Food & Clothing by 50% and
74 t'jl"tt" Computer Sgstems andApplications.-T.Y,B-Com.'(*nt- !I)
Miscellaneous amounts by 3O%. Find the total amount required in Et6 and C6
respectively. Further assuming that this target amount required tn 2O2O taking
into account various other factors is say T 4,5O,0O0 find using goal seek, the
amount that has to be saved each month in the next'6 years in the cell A8 to
meet this target amount assuming no interest being received on arnounts saved.
Solutlon :
1. Select C2 aad.t5pe =B2*1.5O and press enter.
2. Select C3 and t5pe =B3*1.25 and press entbr.
3. Select C4 and t5pe =B4*1.50 and press enter.
4. Select C5 and t5rpe =B5*1.30 and press enter.
5. Select 86 and type =SUM(B2:85) and press enter.
6. Select 86 and drag the frll handle to C6.
7. Select C8 and typJ tne formula = A8*12*6 and press enter.
8. From Data Tab select What-If analysis and then select Goal Seek.
g. In 'Set cell't5pe C8.
10. In To value'type 45000O. This is the goal seek value
11. In tsy changini cell' t5pe A8 and ctcf on ok, the goal seek status dialog box
indicates it has found the value, click on ok, the required amount to be saved
each month is obtained in the cell A8.
Example:
For the following worksheet calculate the DA as lOO% of the Basic Salar5l,
HRA as 33o/o of the Basic Salary when the Basic Salary is t 5O,OO0 or less and
25% otherwise, and Gross Salary in column C, D, E respectively. Find the grand
total of the Gross Salary.
A B c D E
EMPLOYEE NAME BASICSAI.ARY DA HRA GROSSSAI.ARY
SUNDER RA'AN 2tHX)
3 JIGNESH SHAH 25{XtO
KALIM KHAN zt5{80
JEROME D,SOUzA 38{X}O
FREDDY PATEL 60ffn
7
o 2015 Tot8l Gross Sales 850000fl)
2015 Prciected Growth Rate
2015 Projected Growth Sales

Ftg. 7.31
Further using Goal Seek find the projected growth rate in 2ll5 to achieve a
target value of 10,00,00,000.
Solution :
DA
1. Select C2 and type =B2*1.O0 and press enter.
2. Select C2 ar:d drag the fill handle to C6.
HRA
1. Select D2 and type =IF(E!2<=5OO00,Fl2*.33,82*.25) and press enter.
2. Select D2 and drag the fill handle to D6.
GROSS SALARY
1. Select E2 and, type = SUM(B2:D 2l and,press enter.
2. Select E2 and drag the fill handle to E6.
Microsofi, Esrcel Data Analgsis l,'t?' 75
PROJECTED GROWTH RATE
1. Select C10 and type =C8*C9 and press enter. (This will calculate the
projected Sales once Goal Seek has obtained tl.e growth rate in C9).
2. Give cell C9 the percentage format with 2 decimals.
3. In Data Tab select What-If analysis and then select Goal Seek.
4. In 'Set cell't5ryeC10.
5. In 'To value'type 1O00OOOOO.
6. In By changrng cell'qpe C9 and click on ok, the goal seek status dialog box
indicates it has found the value, click on ok, the overall required growth rate
'is obtained in the cell C9. Subtract 100 from the growth rate shown to obtain
the growth rate necessary to achieve this projected sales.
D E

EMPLOYEE NAME BASICSAI.ARY DA HRA GROSS SALARY


SUNDER RAIAN 2fiXlo
25(nO
200fl)
25(n0
6600
8250
w,
58250
4 KALIM KHAN 4s0m ,45m0 14450
JEROME D'SOUZA I 38tx)O 38000 12^tt0 883r{},
:.1
FREDDY PATEL 6ilmo 6Un0 15mo l3.gxlo:

9 I

XI15 Projected Growth Sales 1fiXXXX]ffi

w.7.32
SOLVER
Solver is a What-If analysis tool, which finds t}:e optimurn value in a target
cell by changing values in cells used to calculate the target cells. Hence, when
two or more unknown values have to be determined, Solver can be used: Goal
Seek is.used when there is only one Unknown valui to be found. For example let
us assume that a sale of t 5,00,O00 has to be rrade of three different products if
a company has to break even. Then, using solver we can determine how many
units of each of these three products should be sold, so as to achieve required
goal of the sale amount of ( 5,OO,OO0.
Solver is an Add-in and is found in the Data Tab. If it is not visible.in the
Data Tab it indicates that it has not been insk^lled. To install it, select bptions in
the File Tab and then use the add-in option. ,.,-
Enample: ,'
A Company makes threb products Bats, Racquets aird Footballs whose sale
price is t 3OO,-< 200 and t 15O respectively. For the'company to break even, it
haS to achieve a total sale of t 5,OO,OOO in a.yei1r. U-"hq Solver,- find out the
number of units of each of these three products that should be sold in ofder to
meet the desired target sale.
Solution:
1. In A1 type 300, A2 type 200 and in A3 type 150. I
2. type O-ih the cells e1,eZ and B3.(Solver will entef ttre quantity to be sold of
eachof these 3'products in these cells.
3. 'seleit Cl and !5pe =A1"B1 (here we are aqking Excel.to multiply the selling
price per unit with the qrrantity sold in order to obtain sales val-ue.)
4. , Select Cl and drag the fill handle to C3.
S. Select C4 and t5pe =SUM(CI:C3). This is ttre total salqs to be achieved.
6. In Dl type Bat, D2 t5rpe Racquit and in D3 type Football. -
; . il; 6i;; i';r" ,h; pata rab 1"r."-is"rrJ.l --\ _
.l
i.

A. \
76 t't'r' Computer Sgsfems and Applications - T.Y.B.Com.'(Sem. VI)

s..-f 'r..
m Y {:;,,
yffi
ffist E *
rdr. tffi
(MrW&.
& <@,{
ffi
S'
.IEl
u
.j9
q4ryryud
Sti .:
-
,..:." tle

w.r*Bt@rtdfb6k
F dYtud.rddry
ffirerh(*u.dto
1 300 o 0 BATS 8sE
0 O:RACQUETS
0 FOOTBALL
0

rt9.7.33
8. In the dialog box in the 'Set objective'option the cell C4 rs already selected.
9. In the To'option there is Max, Min and Value. Max is selected when you
' want to increase the goal to the largest value, if Min is selected it decreases
the goal cell to the smallest value. Select Value of and type 5000OO in the
text box.
10. In the option tsy Changing Variable cells'text box enter B1:B3.

s.tftracllc: ifctr ffi


To: . Efx ,.. ifo ,.i] I*r.a* sC@OO

QyChrldtErrr*tltr
BLA3 &r
*Ftcctbf:ffi

ahiltcc

ee
&l!rl'taf

loadEn,G
ts rr{r ursr***g tEier }ar}qrnrG
Sclcdasoa*qtit rto* GRGilalr:{ Atrc
SdiEr+f,rod
<dca tr: GnG frctrcr Gq|ir tu SdtE ffit ftda adr naftr. *d trc t'P #a
tqir fr. hcr Sohc pnd:sr+ adrdcd*aFderyatne fri Sdrcrrollrr *ratre
ffi

Hcb Sdre rlgn

FlA.7.34
11. Then click on Solve. When Solver will obtain the result, click on ok.

300 983.607 295082 BATS


20O: 655.738 131148 RACQUETS dldd*d4drry

150 491.803 73770.5 FOOTBALL aE*Ehil


fsoooool
5 Ep63&hffir&q
6 l---q--l m. I

7 *H.&atuilrdffi&&
8 rbe64EuI€,kBM * r.&. hr*@r
sr'e Y696&p ts@,sanaE$EMr hd.rt6l
9

Fi9.7.35
Microsofi Excel Data Analgsis t't't" 77

12. Round the numbers in Column B by using the decrease decimal option from
the Home Tab. These are the required number of units of each of the three
products that have to be sold in order to achieve the sales goal of t 5O0OO0.
Example:
A Company makes four products Printers, LCD Monitors, Keyboards and
Hard disks whose sale price is { 5000, < 3OOO, t 1000 and t 3500 respectively.
For the company to break even, it has to achieve a total sale of { 1,O0,OO,O0O in a
year. Using Solver find out the number of units of each of these four products
that should be sold in order to meet the desired target sale, given that the
Company has the capacity to make maximum 2000,1000,3000 and 1800 units of
each of these four products respectively in a year.
Solution :

1. In A1 type 5O0O, A2 type 3000, in A3 type 100oand in A.4 type t 3500. .


2. Type 0 in the cells 81 ,B2, B3 and El4. (Solver will enter the quantity to Be
sold of each of these 4 products in these cells.
3. Select Cl and t5rpe =A1*81 (here we are asking Excel to multiply the selling
price per unit with the quantity sold in order to obtain sales value.)
4. Select Cl and drag the fill handle to C4.
5. Select C5 and type = SUM(C1:C4) . This is the total sales to be achieved.
6. In Dl type Printer, D2 type Monitor, in D3 type Keyboard and in D4 type
Hard Disk.
7. Select C5 and from the Data Tab select Solver.
8. In the dialog box in the 'Set objective'option the cell C5 is already selected.
9. In the 'To'option select Value of and type 1OO0O0OO in the text box.
10. In the option By Changing Variable cells'text box enter B1:B4.
11. In the'subject to Constraints'select Add option.(as we want to add the
constraints of the maximum number of units of each of these four products
that the company can produce.)
WT

AilRs{atrc: (00fk*tt
<- l0G0

0( Crrd

Ftg.7.36
12- In 'Cell Reference'type B1 and in constraint type 200O and ctrick on
Add.
13. In 'Cell Reference' type B2 and in constraint type 1O00 and click on
Add.
14. In 'Cell Reference' type El3 and in constraint type 3000 and click on
Add.
15. In 'CelI Reference' type 84 and in constraint type 1800 and click on
ok.
78 ,'t't" Computer Systems and Applications - T.Y.B.Com.-(Sem. V,l

t lobfirtc:
To: ,:13n Sat {t l*rG ,omqm

S(,rc!0lf r*ccar
18*r3i4
SgFdc.t b th. Cdl*A.inB.
F*1 <*4rc
<*18
#
{*ffi
<- llID
ge
&B.tlf

ffi *{f *rs**-C ffi lE}t{Ggnf,r


SqlGdaSdril$!ffi: GR6ib*Eil

SdYifSd
s& t: GnGtffiE gtgi: fu sduGt *rd4 tr*rt sdr rs*rs. sd.d [t! It Hs
.'TE fu trlrs*rs E&t, ild.{t*CtE *6o$ry.'t*. fu sdvr frfu t*t rt
rE#r.

tdrre

?8 7.37

16. Then click on Solve. Wheii Solver will obtain the result, click on ok.
17. Round the numbers in Column B by using the decrease decimal option from
the Home Tab. These are the required number of units of 'each of the four
products that have to be sold in order to achieve the sales goal of
{ 1,O0,OO,OOO.

UNDERSTANDING MACROS
The word 'macro' means an action or a set of actions that 5rou can use to
automate tasks. Macros are an advanced feature of Excel that can speed up
editing or formatting you may perform often in an Excel worksheet. They record
sequences of menu selections that yciu choose so that a series of actions can be
completed in one step. Macros can be used to automate many. tasks in a
spreadsheet - format 'document, insert formulas in cells, perform repeated
calculations, etc. Macros are available in all Microsoft Office products such as
Word, Excel, PowerPoint but we shall study macros only for use in Excel. Macros
use a language called Visual Basic for Applications (VBA) which is similar to
Visual Basic.
The macro feature may not be available by default in Excel. Click on View
and you should be able to see the Macros option in the View ribbon. If the Macros
option is not available in View ribbon, do the following :
Microsofi ExcelDataAnalgsi"s ,"t t, 79

Click Office button, and then click Excel options :

!s
3 na(rostr$rx '@

& Qpen
e s(emriol,xls
3 Xi-Tarminnldrtr-Marrthi.xlfl
&
-{,i{

H sa}?

R SaE As )

Esi t
*
w PrgEre )

ry l?nd )

:ry Pgbiirh )

Gd Elorr

ETffi
.=[:::
t:5\irtf x qit

ftg. 7.38 s Plaf,rlng Uacros


-
In the Popular category, under Top options for working with Excel, select the
Shorry Developer tab in the Ribbon check box, and then click OK.

[xcel Oplions
q6rya&,!*w-;
ffilffirei
Formuhr

Proofing

Save E Show Mini Toolbar on selection0

Aalvan(cal

Curtomize

Add-ln5 coror Blue


fleme
frust (cnt?r Scleennp stylE: Shsw lratur€ ar6criptions in SeraenTipr

Resour("s Create lirts for u'e in torts and titl 5equenc€r: Fdil fil(tom I idr..-

rrg.7.39

To set the security level temporarily to enable all macros, do the following :

1. On the Developer tab, in the Code group, click Macro Security.

Developer

FlU.7.4O: Eaabliag Uacro SccurltY


80 t't'g' - T.Y.B.Com.-(Sem' VI)
Computer Systems and Applications

2. Under Macro Settings, click Enable A11 Macros (not recommended...) and
click OK.
Trusl Centel

Trusted Publishers
ilxro sdtfr}lF
TruJted Lo6tions
For ma(or an do(UlrlCntt not in a trutted iocatiotx
Add-ihs $ Oi:able a1t maaos without notafiGtton

Adiv.X Scttingr
0 plsablr rli Eta('or with notifiEation
0 Disable all maffos crcept digitatty signcd mafiot
o
Mcsrag€ Bar Dcr.elop€{ Uico s€ttingtr
External Contcnt
I Trust accer: to the VBA projed objeEt model
Privary Optionr

Fig. 7.41: Macro Eaable


Ulhere is a macro stored?
When we record a macro, Excel can save the macro so that it is available only
in the current workbook or in all new workbooks we create. If you want a macro
to be available whenever you use Excel, select Personal Macro Workbook. When
you select Personal Macro Workbook, Excel creates a hidden personal macro
workbook (Personal.xlsb) if it doesn't already exist, and saves the macro in this
workbook. If you select the lhis WorkBook option, the macro will be available
only in the current workbook.
Creating Macro :
Macros can be created in two ways : (1) by recording the set of keystrokes or
mouse clicks we make, or (21by writing the code in VBA. We shall study only the
first methodviz., recording a macro.
To record a Macro :
r Click the View tab on the Ribbon
I Click Macros
r Click Record Macro
I Enter a n€une (without spaces)
I Enter a Shortcut Key
I Enter a Description
Viaa

flt li T

ldH
Zoom 100% Ioomto
:rr,t

.'
*i
J
New
-ttt
!
I

An*ngr Free:e
!.U
tr:ptit
-!Hide
: _lj iier, ltdr rI tidt
,.: i,',:":': . ri:. :' .l
ffim
5x* Switrh
Srlertion Window Atl Pine! * I '. ,l:l '
. :: :' .': :'. :
Wo*lpace Windows'
I{om $rindorJ

H ) Mrl{ 0rP
YV.7.42: Recordiag a Macro A B C
Erample 1: 1 Product Li5t Price Dascount ,Sell Price

Record a simple macro that will create a 2 Hard Disk 40fi) 4000
table as shown below and assign the key 3 Monitor 7800 7SO0

combination CTRL+SHIFT + Q to it, so that 4 Xeyboard 12m 1200


whenever CTRL+SHIFT+ A is pressed this 5 Modem 450A 4508
table is created automatically :
fig. 7.43 : Slmple Erample
Microsofi, Excel Data Analgsis jl'3l"r. g1

Step 1 : Click on Developer, in the Code group, click on Record Macro and in
the dialog box that appears, type Macro name as Macrol, in shortcut key, type e
(it will effectively become CTRL+SHIFT+Q), leave the Store Macro in as it is
(default value is This workbook). In description, t5pe My First Macro, click oK.

Record Macro i-i_ Et


Macrol

ctrhshifi+S

Workbook

My First Macro

OK Cancel

r"U.7.++

As soon as you click OK in the above dialog box, the macro recording begins.
You can verify this because instead of "Record Macro" you will see Stop recording
in the Code group.
Type the following data in various cells. In cell D2, type the formula =82-C2.
Drag this formula till cell D5. Once all this data is recorded, click on Stop
recording and your spreadsheet will look as shown in Fig. 7.43.
Your macro is now recorded. To veriff this carry out the following steps :
1. In the same workbook, click on Sheet 2.
2. Click on any cell.
3. Press CTRL+SHIFT+Q (keep CTRL and SHIFT keys pressed with one hand,
and with the other, press Q).
4. You will find the same table appears immediately starting from cell A1. This
is the magic of macros!
Running a macro :
We have already run the macro we created. But let us now state the two ways
in which macros can be run :
1. By pressing the key combination that was decided before recording the
macro.
2. By selecting the name of the macro from a list of available macros. We will
now see this second way of running a macro.
Running a macro by selecting macro name :
1. Create a new worksheet in the same workbook. This may be named as
Sheet 3.
2. Click on the Developer tab, and in the Code group, click on Macros. The
following dialog box opens.
82 n't't' Computer Sgstems and Applications - T.Y.B.Com.-(Sem- V0

Macro II IrEl

Ee
(rBate

Mgcros in: All open Workbooks

t-{yF *M{ro

Ftg. 7.45 : Ruaatng a Eacro


3. Click on Run button. The table appears from cell A1 in Sheet3
Example 2 :
We will now illustrate the use of macros to format a title for a spreadsheet.
1. Create a new worksheet and start recording a new.macro as follows:
Developer) Code) Record Macro.
2. Click on the Home tab of the ribbon.
3. Drag cells A1 to F1 in the worksheet to highlight them.
4. In the Alignment group, click on Merge and Centre icon to centre the title
between cells A1 and F1.
5. Click on the Fill Color icon (looks like a paint can) to open the filI color drop
drown list.
6. Choose Blue, Accent 7 from the list to turn the background color of the
selected cells to blue. (Fig 7.46)
7. Click on the Font Color icon (it is a large letter "A") to open the font color
drop down list.
8. Choose White from the list to turn the text in the selected cells to white.
g. Click on the Font Sizeicon (above the paint can icon) to open the font s2e
drop down list.
10. Choose l6from the list to change the size the text in the selected cells to 16
point.
1 1. Click on the Developer tab of the ribbon

12. C1ick the Stop Recording button on the ribbon to stop the macro recording.
13. Now in a new worksheet, go to cellA1 and type "Income-Expenditure Data for
2014".
14. In the Developer tab, go to Code group and select Macros. Click on Macro 2
and then click. on Run. The text in cell A1 will be formatted as shown in
Fig.7.47.
Microsofi Excel Data Analgsi.s l,'t't' 83

A1 II:

lrr
L_r'

|'Io Fill

More folors,,,

Ftg. 7.46: Macro for Formatting cells

S Recorcl A,lacro e", $ koperties


V{ _:] - ..
Laf vlew Looe
Design
- f,'led* S Eur* oklog
LOge fo ntro s
I

A1 Data for 2014

Incorne-Expendlture Data" for 2G14


Flg. 7.472 Result of running e toacrq

Editing a Macro :
Macros are created in the VBA (Visual Basic for Applications) scripting
language. Thus, to edit a macro, we must be familiar with this language. Let us
take an example of editing the macro we created in the previous example - that of
formatting a range of cells.
Here is the sequence of steps to edit the macro:
1. Keep the workbook open in which we created the previous macro i.e. Macro 2
for formatting a range of cells.
2. Click on Developer menu and in the ribbon, in the Code group, click on
Macros ) Edit.(Fig. 7.a8)

7/T.Y.B.Com - Com. Sys. & Appl. (Sem. - VI)


84 t,"t,'t' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

I
Hemr Inrert Farmulas Bata Rerriew Developer

.._ i.. i;i, :j. ri: ^ - ,, ,t ..,, 1 i

fulacro 2 Ei
F16 "e
B I C D

1 Income-Expenditure Data l@il


hltll
2 *_-r- {reate

4 Delate
5
gption5.

7
I mBcros in: All Open Workbook

Des(ription
-*-+ li Format Cells
10 .J
I

Cancel
13

Fig. 7.48: Editiag a macro

3. When you click on Edit, the Microsoft Visual Basic Editor window opens up
(Fig. 7.ael
'/i Microsofl Visual Basic Bookz
Fgmat Jooli Add-lnr lyindM E.,p
g da t! ir lg. &t'gl iii }*', @
Pr0le{t - t&AProiect
. Book2 Modulel (Codel
YBAP]orcct
Microsof t Excel Obrcctg Format Cells
she6t1 (5h@t1)
Sheetz (5[Eet2)
stEet3 (5[E€t3)
Thiswqkbook Ranqe ( r'41: F1") . SrlecE
Modules IriEh SeIecEion
Modlel .HorizonEallliqment - xlcenter
. VerC icalAl igmenE = x lBottom
.UrapTexE - False
.OEientation = O
.AddlndenE = FaLse
P.opertiei - .fndentl.evel = O
.SttrinkToFit = False
.Readingorder - xLconEext
.I{ergeceILs - False
End lriEh
Se Iect ion. llerge
Irich SeIecEioD. Interior
-PetrFrn r ytSnlid
Fig, 7.49 : Mlcrosoft Vieual Baslc Editor wlndow

4. You can see the VBA code that was automatically created when you recorded
the macro. We will not study this code in detail as it is beyond the scope of
this syllabus. But we will make a few changes in this code and see the effect
when the macro is run. The complete original code is shown below and the
two lines that we will edit are shown in a bigger font and in bold.
Microsofi Excel Data Analgsi"s g't"t," 85
Sub Macro2fl

' Macro2 Macro


' Format Cells

Range("A 1 ").Select
:F 1

With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = O
.Addlndent = False
.Indentlevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
With Selection.Interior
.Pattern = xlSolid
.PatternColorlndex = xlAutomatic
.ThemeColor = xlThemeColorAccentl
.TintAndShade = 0
.PatternTintAndShade = O
End With
With Selection.Font
.ThemeColor = dThemeColorDark 1
.TintAndShade = 0
End With
With Selection.Font
.Name = "Calibri"
.Size = 15
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorDarkl.
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
End Sub
86 ,'t't' Computer Systems and Applications - T.Y.B.Com-(*m' VI)

5. The first line we will.change in this code is


.ThemeColor = xlThemeColorAccent 1
Change it to this:
.ThemeColor = xlThemeColorAccent2
6. Let the Visual Basic window remain open. Switch to the Excel Window and in
the worksheet click on Developer)Code)Macro)Run. You will see the
background color change to a new color (almost brick red color).
7. Go back to the Visual Basic window and change the line .Size=16 to.Size =
10. Go and run the macro again. You can see the font size reduces in cellA1.
This simple example shows us how to edit a macro. Modiff other parts of this
macro and see the output.
Example: Deepa Mehta
234, PinkApartments
This example illustrates the power of a macro to
I

Versova
do repetitive tasks. Assume you have a worksheet that Mumbai - 4{)Gt)61
contains data as shown in the Fig.7.50 and you want the 5

data to appear as shown in Fig.7.5l. (A1l names and 7


Hema Jain
Z ParkAvenue
addresses are fictitious!) Let us assume we have 500 rows of 8 Bandra
such data. 9 Mumbaa - rmo 05{)
10 1

Dilip shah
A-65, Gita Apartments,

D M G Road
iA
Ahmedabed
1 Mehta Versorra Mumbai- rt00061
2 Hema Jain Park Avenue Bandra Mumbai - rtooO50
16 Prerana S
3 Dili Shah 4-65, Gita M G Road Ahmedabad
l7 1030, SkyTo$rers
4 Prerane S SkyTowers Wadala Mumbai
wadala

fE. 7.SO: Orlglaal Data Mumbai


Frg. 7.51
Finat Format Required

Step 1 : Click on Developer ) Code group ) Use Relative References. It is


highlighted.
Step 2 : Click on Developer ) Code group ) Record Macro. Give the name
ML to the macro (short form for Mailinglist).
Step 3 : Select Cell A2.
Step 4 : Click on Home ) Cells ) Insert ) Insert Sheet Rows. It will insert a
blank row in row 2. Repeat this step 4 more times. We are carrying out this
step 4 more times as after the first narne, we need 3 lines for address and
one blank line before printing the new name, etc.
Step 5 : Go to cell E}1. Apply the Cut operation (CTRL+X).
Step 6 : Go to cell A2 and apply the paste operation (CTRI +V1.
Step 7 : Go to cell Cl, apply Cut and paste in cellA'3.
Step 8 : Go to cell D1, apply Cut and paste in cellA4.
Step 9 : Stop recording the macro.
Now go to cell A6 and click on Macros ) select macro ML and click on Run.
You will find the second name is formatted properly. Repeat this exercise by
clicking on successive names.
Microsofi Excel Data Analgsis lt't?' 87

OBJECTIVE
I. State whether the following are tnre or false :
l. When data is filtered, it is also sorted in ascending order.
2. The AutoFilter command adds drop-down arrows to header rows.
3. Once drop-down arrows are added to the header row, they cannot be removed.
4. A graph can be created only through the Insert -> Chart option.
5. No modifications can be made to a chart.
6. The chart wizard can create new charts as well as modi$r existing charts.
7. If the data values in a table are changed, the chart also changes.
8. A chart cannot be moved around on a worksheet.
9. The Legend on a chart can be removed.
10. A pie chart can be drawn only from a single data series
1 1. The most appropriate form of chart for continuous data is the line chart.

12. To plot chart based on two columns, the two columns must necessarily be adjacent
to each other.
13. Any number of data series can be used to plot a bar chart.
14. All types of charts can be created through the Chart Wizard.
15. When plotting a chart, the labels for the data should not be selected as they are not
numeric data.
16. Embedded charts can be created directly on a worksheet.
17. Solver and Goal Seek are used for the same purpose in Excel.
18. A macro can be used to automate the creation of a chart.
19. Once a macro is created it cannot be modified.
20. Goal Seek is the process of finding the point where costs equal revenue.
21. Solver problems are limited to a single changing cell.
22. A Scenario uses changing cells.
23. Scenarios allow more than one variable to be changed at a time and automatically
generate a two-variable data table.
II. Multiple Choice Questions
Select the appropriate optlon from the following :
1. AutoFilter feature allows the user to :
a) Copy data that matches a criteria into another worksheet
b) Display data that matches certain criteria
c) delete data that matches a criteria
d) Perform calculations only on selected data
2. Which types of charts can Excel produce?
a) Line graphs and pie charts only
b) Only line graphs
c) Bar charts, line graphs and pie charts
d) Bar charts and line graPhs onlY
3. The chart wizard
a) Can place a chart on a new chart sheet or on any sheet in the workbook
b) Can only place a chart on new chart sheet
c) Can only place a chart on a new blank worksheet
d) Can only be used to create embedded charts
4. What chart object is horizontal or vertical line that extends across the plot area to
make it easier to read and follow the values?
a) Category axis, b) Data marker,
c) Data point, d) Gridline
88 jl"t"f' Computer Systems and Applications - T.Y.B.Com'-(Sem' VI)

5. Using the Fl 1 shortcut key to create a chart on chart sheet creates


a) A default chart,
b) A 2-dimensional column chart,
c) A 2-dimensional bar chart,
d) A 3-dimensional line chart
6. When two or more values have to be determined, which data analysis tool is used?
a) Solver b) Goal Seek
c) bar chart d) Data Table
7. Which of the following tool you will use in Excel to see what must be the value of a
cell to get required result?
a) Formula Auditing b) Research
c) Track Change d) Goal Seek
8. Which of the following is not What IF analysis tool in Excel?
a) Goal Seek b) Scenarios
c) Macro d) Data Table
9. Goal seek can be defined as :

a) Searching for a cell with a specific value.


b) A mathematical process that changes the values of many cells to find the best
objective function
c) Working backward from a desired result to find the unknown value that produces
the desired result.
d) The combination of variables used in performing what-if analysis
10. In a Goal Seek problem, you must speciff all of the following except :
a) a scenario narne
b) a value to be reached
c) a set cell that contains a formula
d) a changing cell that contains an initial value.
1 1. Solver is a What-If analysis tool that :
a) depends on the use ofscenarios
b) is an add-on product that is not automatically installed into Excel.
c) is used for simple analysis problems
d) is same as goal seek.
12. A Scenario uses all of the following except :
a) changing cells b) a table area
c) result cells d) formulas
13. Scenarios are What-if analysis tools that:
a) are limited to one result cell
b) allow the user to view many outcomes simultaneously
c) allow viewing a graph along with data
d) allow the use of more than two changing cells.
14. Which of these tools is used to perform What-If analysis?
a) Scenario Manager b) Goal Seek
c) Solver d) All of these
15. You want to track the progress of the stock market on a daily basis. Which type of
chart should be used?
a) Bar chart b) Pie chart
c) Line chart d) Column chart
16 If we want a macro be available in all workbooks it should be stored using which of
these options?
a) This Workbook b) New Workbook
c) Personal Macro Workbook d) public Macro Workbook
17. After recording a macro you c€rn modiff it using :
a) The Visual Basic editor
b) The macro security feature of Code group
Microsofi Excel Data Analgsis jl,t"jl" 89
c) Modiff Macro feature of Code group in Developer tools
d) Macros ) Edit in the Code group of Developer

ANSWERS
I. [True : 2, 4, 6,7,9, lO, 11, 13, 14, 16, 18, 22
False : 1, 3, 5, 8, 12, 15, t7, 19,20, 2I, 23 |
III. [(1 -b), (2-cl, (3-a), (4-d), (5-b), (6-a), (T -d), (8-c), (9-c), (10-a), (11-b),
(12 -bl, (13 - d), (14 - d), (15 - c), (16 - c), (17 - d) l

QUESTTONS
trIrlte short answers :

1. What is meant by filtering of data?


2. What is the difference between AutoFilter and Advanced Filter?
3. What are the two ways in which data can be filtered in Excel?
4. Explain the use of the AutoFilter command.
5. What is a chart?
6. State the different types of charts available in Excel 2OO7.
7. State and define any 6 elements of a chart.
8. State one important feature of each of these chart t5pes : (i) column chart, (ii) bar
chart, (iii) line chart, (iv) XY chart, (v) pie chart
9. What is a scenario in Excel? What is the use of this feature?
1O. What is the essential difference between Solver and Goal Seek tools? In which menu
of Excel are these tools available?
11. What is a macro? In which language is a macro written?
12. What is a macro? List the steps to record a macro.
13. List the steps to run a macro.
14. Describe the tools available in Excel for decision-making.
15. Explain how GoaI Seek command facilitate the decision making process.
16. List the steps to enable the macro tool in Excel from the Excel options in Office
button.

PRACTICAL EXERCISES
1. Enter the following data into a worksheet.
Sales Turnover for BNU Enterprises Ltd.
Jan Feb Mar Apr May Jun
Mumbai 50000 60000 70000 75000 75000 70000
Delhi 20000 24000 30000 30000 35000 40000
Chennai 45000 50000 55000 60000 55000 50000
a) Calculate the total values for each row and each column.
b) Calculate the average, max and min values for each row and column.
c) Create a pie chart indicating percentage contribution of total turnover for each
branch.
d) Create a line graph that allows comparison of branch turnover month by month.
e) Enter the values for targets into the worksheet
90 jl'n'jl' Computer Systems andApplications-T.Y.B.Com.'(Sem. VI)

2 Targets for the months in question were as follows :

Jan Feb Mar Apr May Jun


Target < 15000 t 16000 t 16000 t 17000 < 17000 t 16000
Achieved 1 1700 16450 10900 1 1000 t7200 15900
o/oof target achieved for each month by all branches.
Calculate
Create a line chart comparing target with actual turnover.
3 The book value per share of a housing finance company for the last three years is
shown in the table below. Draw a column chart for tJ:e data. Give appropriate
headings.
2o,o6-o7 20,07-oa 2()()8-o9
t23.67 145.00 178.55
4. Given the following worksheet :

A B c D
Student Exam 1 Exarn 2 Exam 3 Exam 4
Prerana 85 79 77 81
Jenifer 77 73 69 72
Mumtaz 68 69 79 81
Aishwarya 76 77 69 74
Write steps to create following charts :
a) Line chart for each student for each exarn. Consider Students on X axis and
marks on the Y axis.
b) 2D pie chart for E.xarn 2
c) 3D pie chart for Jenifer
5 Create a macro to format the spreadsheet as follows so that whenever the user
presses the key combination CTRL+SHIFT+Q, this layout is created.

IABCDE ti
l- i l,J

ABC CGLLEGE OF COMMERCE & MANAGEMENT


MARKSLIST OF SEMESTER 5 EXAM

STIBJEC {TANCY T
RollNo Name Marks

Font size in row 1 is 14. Choose Font as Calibri. Font size in row 2,4 aurrd 6 is 12.
Row 4 has a Fill Color of 'White, Backgroundl, Darker 25o/o". All fonts are Bold. This
macro should be available only in the existing workbook. List all the steps required
for this exercise.
6 The following table shows the monthly expenditure on different heads and the
income of Mr. Mehta. Use the Scenario feature of Excel to study the effect of reducing
expenditure on Club fees, Internet access and food and how it affects the balance
income.
Microsofi, Excel Data Analysis lt't't' 91

1
Particulars Experditure lncome
Rent 11000 50m0
Food 111000
Phone Bills 500
6 Clothes um
Travelling 30(n
I Club 50m
I lnternet 7tn
10 Books 600
Health Care ili00
L2 EMls 8{no

14 Total Expenditure 1155{n

lncome Left 4500

7. Deepali starts a business and is making a profit of t 25,O00 per montJr through her
e-commerce website. After 6 months she decides to set a new profit Goal of t 35,000.
At the moment, she is selling 1000 items at ? 25 each. Assuming that she will still
sell 1OOO items, by how much should she increase the prices to achieve the new
profit of 35,OOO? Use the Goal Seek feature of Excel.

r'''l,'

\
92 t't't' Computer Systems and Applications - T.Y.B.Com--(Sem. VI)

MODULE I
ISUAL BASI

Introduction to
8 Yisual Bosic

INTRODUCTION
Visual Basic is a programming language that provides tools to create
Windows-based programs. These Windows-based programs have the familiar
elements like menus, text box, label, command buttons, scroll box, etc.
Microsoft Windows operating system uses a graphical user interface (GUI)
and Visual Basic (VB) is an ideal programming language for developing
sophisticated professional applications for Microsoft Windows. It makes use of
Graphical User Interface for creating powerful applications.
The origins of Visual Basic can be traced back to one of the oldest and most
popular programming language of the 1960s and 1970s - BASIC. BASIC is an
acronym for Beginner's Nl-Purpose Symbolic Instruction Code. The earliest
versions of BASIC could be used to develop DOS-based programs only (i.e. no
graphical user interface). Over the years, this transformed into a very robust
programming language called Visual Basic. The word "Visual" implies that Visual
Basic supports a graphical user interface, and common graphical elements like
forms, buttons, check boxes, option buttons, windows, etc.
CLASSIFICATION OF PROGRAMMING LANGUAGES
There are hundreds of programming languages but the most common today
are Visual Basic, C, C++, C#, Java, PHP, Ruby, Perl, Srthon, JavaScript, and
Delphi. Each language is suitable for a particular type of application. For
example, for scientific calculations C, C++ and FORTRAN are very common. For
Internet-based applications Java is popular.
But all programming languages can be classified into three broad categories :
O Procedural Programming Languages : Traditional programming
languages such as C, COBOL, FORTRAN, and BASIC are procedural languages.
The program specifies the exact sequence of all operations. The sequence in
which instructions will be executed depends on the program logic.
O ObJect-Oriented programming languages : g++, C#, Java and Visual
Basic are object-oriented languages and they use the concepts of Object-Oriented
Programming (OOP). An object can be thought of as a collection of data and
methods or functions that can operate on that data.
O Event-driven programming languages : In event-driven programming
languages, programs do not follow a sequential logic. The sequence of execution
is controlled by the user. The user can press a key, click a button, etc. and each
Introduction to Visual Basic l,'l?'t' 93

action causes an euent to take place. This event triggers (i.e., starts the execution
of) a procedure that the programmer has written. Thus, the flow of the program is
determined by events. These languages use features of object-oriented
programming languages.
Event-driven vs Traditional Programmlng
In a traditional or "procedural" application, the application itself rather than
an event controls the portion of the code that execute. Execution starts with the
first line of code and follows a predefined path through the application. Examples
of such procedural languages are C and FORTRAN.
In event-driven programs, a user action executes a procedure. The order in
which the code executes depends on what the user does. Thus in event-driven
programming, the user is in-charge and the code responds accordingly. Examples
of euent are mouse click, pressing a key, releasing a key, drag mouse, etc.
Visual Basic combines the best features of object-oriented programming and
event driven programming.
THE OBJECT MODEL
Since Visual Basic uses features of object-oriented programming, we work
with objects in Visual Basic. We now define a few terms that are essential to
understand and used Visual Basic.
Object : An object is an entity or a thing. All the user interface elements such
as command button, text box, check button, option button, window, etc are
objects in Visual Basic. On your Windows desktop, the icons you see are objects.
i) An object is an entit5r or a thing.
i0 Objects can contain other objects. E.g., a form can contain buttons, text
box, label, menu, etc.
iii) Object consists of data and code to operate on that data.
iv) Objects have properties. These properties can be set when an object is
created, but we can also assign a new property later.
v) Examples of objects are form, command button, text box, check box,
option button, image box, etc.
Properties : All objects have properties.
0 A property tells us something about an object. Just as a book has
properties such as number of pages, length, breadth, type of cover,
edition, etc., similarly, all objects in Visual Basic have properties.
ii) We can refer to the property of an object by separating the object name
and property with a dot (.). For example, a command button may have a
caption and this can be written as cmdClear.Caption. Here, cmdClear is
the name of the object and Caption is its property.
iii) Objects have a default property which can be changed by the programmer
at design time or at run time.
iv) Properties can be set when an object is created, but we can also assign a
new property later
Methods : Methods are actions associated with objects. For example, Print,
Clear, Resize, Move. On a music system you may have the play, fast forward or
reverse buttons. Once any of these buttons is pressed, the system can perform
without any further assistance from us. These buttons perform some actions.
Events : An event is an action recognized by a form or a control. When
particular event takes place, the code for that event is executed. E.9., when a
command button is clicked, the code for the click event of that button is

I \
94 t't't' Compruter Sysfems andApplications-T.Y.B.Com.-(*m.W
executed. Each object in Visual Basic has a predefined set of events it can
respond to. Certain events occur along with other events. For example, when the
double click (DblClick) event occurs, the MouseDown, MouseUp, and Click events
also occur.
WRITING VISUAL BASIC PROJECTS
Writing a Visual Basic project is a three step process. These 3 steps are :
Step 1 : Design the User Interface (UI).
The user interface will decide how the program will look and how it will
process information. The complete set of screens and images used in a program
is called the program's user interface.It includes menus, command buttons, text
boxes, option buttons, etc.
In designing the user interface we first draw a rough sketch of the screens
the user will see. In this design we show the different objects, their position on
the form, and gives names to each object. We must discuss this aspect of the
project with the user.
Step 2 : Define the properties.
For each object, we must write down the properties that are to be changed
during the design of the form.
Step 3 : Creating the code (programs).
This step involves writing the code that will execute when the program runs.
We write code for each event that can take place.
VISUAL BASIC PROJECTS
Visual Basic projects consist of the following types of files :
O The .VBP file : This is called the project file. It is a small text file that
contains names of other files used in the project. It also contains some
information about the Visual Basic environment.
O The .FRM file : Each form in the Visual Basic project is saved with a .FRM
extension. This file contains description of all objects and their properties
for the form. It also contains code that we have written to respond to the
events. Each form file is called as a form module.
O The .BAS file : A file with extension .BAS contains code that can be
accessed from any form in the project. Such files are also called standard
code modules.
O The .OCX fi1e : Additional controls are also called custom eontrols, and
these are stored in files with extension .OCX. If you add controls in your
project that are not part of the standard control set, then the .OCX files
must be included in the project.
O The .VBW file : After we save a project, Visual Basic automatically adds a
file with extension .VBW. This file contains information about each form
in the project.
THE VB INTEGRATED DEVELOPMENT EITVIROITMENT (IDEI
Integrated Development Environment or IDE is a term commonly used in the
programming world to describe the interface and environment that we use to
create our applications. It is called integrated because we can access all the
development tools that we need from one screen called an interface. The IDE is
also commonly referred to as the design environment.
The Visual Basic environment enables us to create and test our projects. The
Visual Basic environment consists of the following components :
Basic
Introduction to Visual t jl jo gs

1. The Forn trIlndow or Form Designer : (Fig. S.1) This is where we design
the forms and plan the user interface. When we start a new project Visual Basic
automatically gives the default name Form I to this form. This name can be
changed later.
ldi.rosott Visual Easic Idesign]

t Frolc,:11 F(,nnl
= -rtX
{Fornr)

r Frrltr 1

Fig. 8.1
ie.tl
2. The ProJect Erplorer Window : (Fig. 8.21 This
window shows the filenames for the files included in the Preildf
Frymj
project. The name of the project with extension .VBP, is ,S@
shown in the title bar of this window.
FiS.8.2
3. The Propertles Wlndow : (Fig. 8.3) From this window we can set the
properties of the different objects, such as change ttre background color of the
form, change the size of a button, etc.
Propertaes - Fornrl EI

l-3D

2 - Sizable
Forml
True
True
13- Pen
D - Solid

True
&t-tooooooooS

M5 Sans Serif
True

rig.8.3
96 t't'l,' Computer Syslems and Applications - T.Y.B.Com.-(Sem. VI)

ser::g
tI PichfeBox
Label Arl
4. The ToolBox Window : (Fig. 8.4) The Toolbox Frme

contains various tools such as label, options button, i, OptionButton

command button, check box, text box, etc. These tools ListBox
t
can be plac'ed on the form by double-clicking on the t
respective icon.
Timer
!rl
The various controls shown in the above figure are JI
described below :
Shape
f,r.
knage
Data
OLE

rig.8.4

Control Description
Polnter Provides a way to move and resize the controls form
PictureBox Displays icons/bitmaps and metaliles. It displays text or acts as a
visual container for other controls,
TextBox Used to enter text and display message.
Frame Serves as a visual and functional container for controls
CommandButton Used to carr5r out the specified action when the user chooses it.
CheckBox Displays a True/False or Yes/No option
OptionButton OptionButton control which is a part of an option group allows
the user to select only one option even it displays mulitiple
choices.
LlstBox Displays a list of items from which a user can select one.
ComboBox Contains a TextBox and a ListBox. This allows the user to select
an ietm from the dropdown ListBox, or to type in a selection in
the TextBox.
HScrollBar and These controls allow the user to select a value within the specified
VScrollBar range ofvalues
Timer Executes the timer events at specified intervals of time
DriveLlstBox Displays the valid disk drives and allows the user to select one of
them.
Dirl,istBox Allows the user to select the directories and paths, which are
displayed.
FlleListBox Displays a set of files from which a user can select the desired
one
Shape Used to add shape (rectangle, square or circle) to a Form
Llne Used to draw straight line to the Form
Image used to display images such as icons, bitmaps and metaliles. But
less capability than the PictureBox
Data Enables the use to connect to an existing database and display
information from it.
OLE Used to link or embed an object, display and manipulate data
from other windows based applications.
Label Displays a text that the user cannot modiff or interact with
Introduction to Visual Basic gT

1. The Form Layout Window : The position of the form on the desktop can
be adjusted from this window.
2. Menu Bar : This Menu Bar displays the commands that are required to
build an application. The main menu items have sub menu items that can be
chosen when needed. The toolbars in the menu bar provide quick access to the
used commands.
DESIGN TIME, RUN TIME AND BREAK TIME
Visual Basic has three distinct modes :
a) Design Time
b) Run Time, and
c) Break Time
af Design Time : When we are designing the user interface and writing the
code, we are in design time. Any errors that occur in the IDE and before the
program is compiled are called design time errors. Syntax errors detected at this
stage.
bl Run Time : When we are testing and running our project, we are in the
run time mode. Certain errors can be detected only on running the program.
Such errors are called run time errors. For example, consider the statement
Result = A I B.This will give an error only when the value of B is zero.
cf Break Time : When we get an error in the run time or when we pause
execution of a we are in the break time.
FINDING AND FIXING ERRORS
Three t5rpes of errors are possible in a program. These are :
1. Compile Time Errors
Visual Basic must convert our source code (i.e., the program we write) to
machine code before the program can run. This is called the compilation phase.
During the compilation phase, if Visual Basic.finds any erors in the s5mtax, then
it is called compile time error. Examples of compile time errors are s5mtax errors,
not declaring a variable, illegal use of objects, using an object name that is not
declared. The word s5rntax means "grammar". Thus s5mtax errors are errors that
occur when we do not follow the rule of Visual Basic programmirrg. E.g., using
the word ENDD instead of END, a missing bracket, etc.
2. Run Tlme Errors
This is an error that causes a program to stop unexpectedly during
execution. Run time errors occur during execution. When such an error occurs,
Visual Basic displays a dialog box and goes into break time. The statement that
caused the error is highlighted.
Run time errors occur not due to the syntax but because a statement cannot
be executed, e.g., trying to open a non-existing file for reading, or division by
zero. Consider the example, where the user has to enter values of two variables A
and B and the program must divide A by B. If user enters value of A as 6 and B
as 2, the calculation RESULT = A/B will store the value 3 in variable RESULT.
But if the user enters the value of B as 0, then we get the run time error "Division
by zero".
3. Logic Errors
This is a human error. The program will execute but will gtve a wrong result.
For example, consider the problem of finding the average of 3 integers A, B and
C. If the programmer writes the statement AVG = A + B + C / 3 then this will
produce a wrong result but there will be no s5mtax and no run time error. The
correct way of writing this statement is of course AVG = (A + B + C )/3. Note the
brackets in this statement.
98 ,'t"r' Computer Sgstem,s and Applicatbns - T.Y.B.Com.-(Sem. VI)

Logrc errors cannot be detected by the compiler but must be tracked down by
the programmer. The output obtained must be viewed critically and the program
must be tested for all possible values of inputs to see that the output obtained is
meaningful.
GETTII{G STARTED WITH VISUAL BASIC
In Microsoft Windows XP, click the Start button, point to All Programs, and
point to Microsoft Visual Studio 6.0. Click on Microsoft Visual Basic 6.O.
Start -* All Programs --* Microsoft Visud Studio 6.0 -- Microsoft Visual
Basic 6.0
1. Visual Basic loads and we see the dialog box as shown in Fig. 8.5 :
New Projecl ? ><.

xo le**irsl nr6.l

kb
A(tlv.X EXE Acti%X oLL ActivrX \/8 Appken
Cmhol *&ed

N
VE Wiz{d
M!n4!r
g
ActiEX
Docmt Dll
g
Adivox
Documdt E!.
s
Addl
&
Ddr Pro,qt

l- s*' -l
cryd I

E"b I

l- Dql *or?* ddog h fEtghr"

lYew Box
This dialog box prompts us to s elect type programming project.
2. Select Standard EXE as shown in Fig. 8.5 and click Open button. A new
project opens in the Visual Basic programming environment.
3. The following window appears (Fig. 8.6).
^
proic.ll Mic.osorl visudl lldsi(: I dcriRDl n[x
Ba En yB Bo,d FsM Qlt { Bo qr.ry q.ors loob Ad&h ffi, tt b
& r.b ) ll o,0

\ r I,rojecll Io,rnl {torn, - trliix


A G6'I - ,ltr] tx S tuhr(tuht)
itJ
F

@e

' il.stan fsl r,.r,,r,,r,,r r,r r lrhlrrj l:.Flctrrr L:in h rr,,ri I I rn

Flg.8.6
Basic
Introdudionta Visual t'jl'lr" 99

Although the screen can look confusing, we can fully customize the Visual
Basic screen to suit our needs and preferences. These windows are all
dockable; a dockable window is one that we can resize and move to the sides
of the screen and connect to other windows.
We will now develop a simple application to print the message "Hello World".
4. On the left side of the screen we can see the toolbox (if this doesn't show up
go to the top menu bar and select View -> Toolbox). In this toolbox you will
see a picture of a button. Double click the button icon and it udll create a
Commandl CommandButton in the center of your form. (Fig 8.7)
+ Projecll 'Microsoft Visual B*ic Idesign] -[Forml (Forml] trIEB
lil
r [orm1 rltElE
Proi€ct I
Form5
b Foml (Forfil)

..r i'

Ftg.8.7
5. We now place one more command button on the form. To do this, again
double-click on the Command Button icon in the tool box. The form now
looks as shown in Fig. 8.8.
\ Pro jecll I orml {, orm} l": trft rl
r I orml -:x

Cqmdl Cmrd2

Fig.8.8
6. Place a label object on the form. Double click on the label object in the tool
box. This creates a label object with the caption Label 1'
7. Now we set the properties of the label object.
a) Click on the label on the form. Click on the title bar of the Properties
window. The object box at the top of the properties window is showing
Label1 which is the default name of the object.
8/T.Y.B.Com - Com. Sys. & Appl. (Sem. - VI)
lOO t't't' Comprier Systems andApplications -T.Y.B.Com-(km. VI)

b) Select the Name property. Click on Name and notice that the Settings box
shows Labell as the default name of the label. 1}pe lblMsg so that this
becomes the new nzrme of the label object.
c) Click on the Caption property of the label. The Caption propert5r of a label
determines what will be displayed on the form. It shows "Label 1". Press
the Delete key so that caption disappears.
8. Now we set the properties of the command button 1 object.
a) Click on the first command button (Command Button 1) and then click on
the Properties window. It shows the properties of the Comamnd Button.
b) Change the name of the command button to cmdMsg.
c) Change the Caption to Message. The word "Message" (without the quotes
marks) will now appear on top of the first command button.
9. Now we set the properties of the command button 2 object.
a) Click on the second command button (Command Button 2) and then click
on the Properties window. It shows the properties of the Comamnd
Button.
b) Change the name of the command button to cmdExit.
c) Change the Caption to Exit. The word "Exit" (without the quotes marks)
will now appear on top of the first command button.
1O. We set the Caption properties of the Form.
a) Click on the Form and the Properties window will now show properties of
the form.
b) Change the Caption property of the form to "Hello World". The Caption
propert5r of the Form determines the text that will appear in the tifle bar
of the Form window.
The interface has now been designed and now we must write the code that
will be executed when the user clicks on the two command buttons.
11. Visual Basic code is written in Sub procedures. Each sub-procedure begins
with the words Private Sub and ends with the words End Sub. Event
procedures are automatically named by Visual Basic. The object name is
followed by the underscore character (_) and then the event name. E.g.,
cmdMsgCtck$.
12. Double click the command button named cmd Exit. This brings up the code
window as shown in Fig. 8.9 below :
t Projecl l I orml (Codc! X

Prlvrs. !tb sdlxir Cllst{i


t-
lrd sub

Fig. 8.9
Introduction to Visual Basic t,'lt't' 101

Click in between the lines Private Sub cmtExif_Click0 and End Sub. Press
the Tab key once to indent the code (i.e. shift the code to the right). Then type
the following lines :
'End the program
End
The code will now look like this
Private Sub cmdExit_ClickQ
'End the program
End
End Sub
The statement that begins with the tharacter is called a comment statement.
It is ignored by the Visual Basic compiler but it tells the programmer the
purpose of the sub-procedure.
The statement End signifies the end of the program.
13. Now we write the code for the other command button i.e. cmdMsg. Double
click this command button to bring up the code window for cmdMsg. I}pe
the following code :
Private Sub cmdMsg_Clickfl
'Message t o display when this button is clicked
lblMsg.Caption = "Hello World"
End Sub
14. Now run the program by clicking on the Run menu, and choose Start. Or we
may also click on the Run button that appears on the tool bar (solid triangle).
15. On running the program we see the following window :
r Forml .

Mcsage Exl

Ftg.8.10
If we click on the Message button, the output appears as follows
r Forml

HdoWsH

Ex*
EESr-3

Ffg. 8.11
1O2 lr'tn ' Computer Systems and Applications - T.Y.B.Com-(*nt' W)

16. Click on the Exit button to exit from the program.


17. Now save the project. Click on File - Save Project. In tJ:e dialog box that
appears, first create a folder called Hello. Save the project in this folder. Give
the project name as Hello. Visual Basic also asks us to give a name to the
form file; give the name as Hello.
This was a very simple program to print a message. Experiment by changing
the message, or print your name in the code.
In the next chapter we will study in detail about the various Visual Basic
controls such as text box, check box, command button, labels, etc.

OBJECTIVE QUESTIONS
I. State whether the followlng are true or falsc :
1 Visual Basic is an event-driven programming language.
2 All programming languages are event driven languages.
3 Visual Basic can be used to develop GUI based applications.
4 Multiple events can take place at a time.
5 The Project Explorer window shows the properties of an object.
6 Various controls such as the TextBox, Label, CommandButton are found in the
Project Explorer window.
7. MouseDown is an example of an event in Visual Basic.
8. Move is an example of a method in Visual Basic.
9. The properties of different objects can be set from the ToolBox window.
to Visual Basic code is written in sub-procedures.
u. Multiple Choice Questlons
Select the most approprlate alternatlve from amoagst those glven and rewrlte
the sentence :
1. _ are the basic building blocks of Visual Basic Application.
a) Forms b) Method
c) Events d) Controls
2. Advantages ofVB are :
a) Rapid application development b) Event driven program concept
c) Create applications with GUI d) All of the above
3. The window that describes every individual element of a form is
a) Form window b) Property window
c) Project window d) None of the above
4. contains the controls, which one carr use in the creation of a form.
a) Menu b) Tool Box
c) Tool bar d) Project window
5. Which of the following file types contains the names of other files used in a Visual
Basic project?
a) .FRM; b) .OCx
c) .VBP d) .FRM
6. The only object-oriented language amongst the following is :

a) CoBoL; b) C
c) Visual Basic; d) C++
7. The only event-driven language amongst the following is :
a) C; b) C++;
c) 'Visual Basic; d) COBOL
Introductionto Visual Basb ,,,,'r, 1O3
8' If an object obj has,a property prop than which of the following is the best way to
state the property of the object?
a) obj; obj.prop; b)
c) prop.obj; prop d)
9. In a vB project, the form design is carried out in the window :
a) Properties; b) ToolBox;
c) Project Explorer; -
d) Form window
10. Which of these is not a distinct mode of Visual Basic?
a) Run Time b) Design Time;
c) Break Time d) Compile Time
11. Which of these errors can be detected at compilation stage by the Visual Basic
compiler?
a) Syntax error; b) Run time error;
c) Logical error; d) All ofthe above
12. Visual Basic code is written in _.
a) Sub procedures; b) functions;
c) Form; d) routines
13. The comment character in Visual Basic is :
a) tharacter; b) the /* */ character pair;
c) the / / character, d) the g character
14. Which of these is not a component of Visual Basic IDE?
a) Form Window; b) ToolBox;
c) Picture box; d) Project Explorer window
15. What is the meaning of VBP?
a) Visual Binary Project; b) Visual Basic Project;
c) Very Basic Project; d) Visual Basic Parameter

ANSWERS
I. [True : I,3,4,5, 7, 8, 10
False : 2, 6,91
III. [(l -a), (2-dl, (3-b), (4-b), (5-c), (6-d), (7 -c), (8-b), (9-d), (10-d), (11-a),
(12 - a), (13 - a), (14 - c), (15 - b)l

QUESTIONS
1. What programming language is Visual Basic based on?
2. What are procedural languages? Give two examples of such languages.
3. What are object-oriented languages? Give two examples of such languages.
4. What are event-driven languages? Give two examples of such languages.
5. What are the differences between procedural and event-driven programming
languages?
6. Why is Visual Basic known as event-driven programming language?
7, What is an object? Give some examples of objects in Visual Basic.
8. What is meant by the term "propert5/ of an object? Give some examples.
9. Differentiate between properties, methods and events.
10. In Visual Basic, what is design time, run time and break time?
11. What are the different types of errors that can occur in a Visual Basic program?
12. With the help of an example, explain the term "compile time error".
13. With the help of an example, explain the term "run time error".
14. With the help of an example, explain the term "logical error".
1O4 jl"jl"jl" Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

15. What are the different types of files in a Visual Basic project?
16. State the purpose of each of these Visual Basic file types: .VBP, .FRM, .BAS, .VBW
and.OCX
17. What are the three steps for planning and creating a Visual Basic project?
18. What are the components of Visual Basic IDE?
19. What is a Visual Basic event? Give some examples.
20. What is the purpose of remark or comment statements in a Visual Basic program?
22. Short Notes
Write short notes on the following :
1. Tlpes of programming languages.
2. Objects, properties, methods and events.
3. T}pes of files in a Visual Basic project.
4. Compile time errors.
5. Logical errors.
6. Run time errors.

,"t?'
Vriable s, Constants and C alculations t"t"'" 105

Yariables, Constonts
9 and Calculations

INTRODUCTION
Visual Basic programming language can be used to write programs which
involve many calculations. The most common arithmetic operations of addition,
subtraction, multiplication, and division are possible. In this chapter we will
study how data is stored and handled by Visual Basic.
VARIABLES
In programming, when we talk of a computer's memory, it usually means the
primary memory, i.e. the random access memory (RAM). Although the secondary
storage devices such as hard disk, pen-drive (USB drives), CD-ROM, etc are used
for storing data, from a programmer's viewpoint, RAM is more important. This is
because, all data must first be stored in the RAM, manipulated by the CPU, and
then it may be transferred to the secondary storage.
A computer contains vast amount of memory (RAM). Tlpically, this is abott2
gigabytes (approximately 2 billion locations) nowadays. Each memory location
has a fixed address. But since the number of memory cells is very large, it is not
possible for the progr€rmmer to keep track of these physical addresses. Also,
some memory locations will be used by the operating system such as Windows,
and so all the available memory of a computer is not for our own data.
A uariable is a memory location that lalds data tlnt can be changed during tle
execution of a program. TWo things are associated with a variable: its name and
data type. The variable name is used to refer to data stored in memory. The data
type decides what type of data can be stored in memory, what is the range of data
that can be stored (e.g. the largest and smallest number that can be stored), and
the permissible operations on that variable.
Declaring a variable : A variable must be declared before it is used. The
declaration of a variable means speciffing its data t5rpe. In Visual Basic, a
variable is declared as follows :
Syntax : Dim <varname, [AS <data typer]
o@@@
Thus, a declaration statement is made up of four parts which are as follows :
O DIM is a keyword. The word Dim stands for "dimension", which means
"size'. When we declare a variable, the amount of memory space required
depends on its data type. The memory requirements for various data
tSrpes are shown in Table 1.
@ <varna.me> is the name of the variable; the variable name is also called as
an identlfler as it identifies a memory location.

\
106 tn3'jl' : Conputer Sgstems and Applirations - T.Y.B.Com-(*m- VI)

@ AS is a keyword in Visual Basic.


@ <datatype> is a legal data type.
In the above syntactical notation, whatever comes inside the square brackets
is optional. But whatever comes inside the angular brackets < and > is
compulsory, and must be provided by the programmer.
Thus, a statement that declares a variable is 'called as a declaration
statement. It is a non-execttable statement.
E:ramples:
Dim strStudName As string 'this statement declares a string variable
Dim intRollNo as Integer 'this statement declares an integer variable
Rules for forming variable names :
1. A variable narne must be meaningful. E.g., to stori the marks obtained by a
student, we may use only the character M but it is not meaningful. Instead it
is better to use intMarks.
2. A variable nErme must start with a three letter prefix that specifies the data
type. The prefix for various data types are shown in Table 1.
3. A variable name may contain only letters and digits. Special characters such
as space, the symbols *, #, *, etc are not permitted in a variable name.
4. A variable name must not be of more than 255 characters. In practice, we
normally use variable names of 8-10 characters only.
5. Reserved words (keywords) of Visual Basic cannot be used as variable names.
6. If a variable name is formed by joining two words, capitalize tJ:e first letter of
each word, and the remaining characters must be small. This is called "camel
notation". E.g., strStudentName.
Constants : Quantities that do not cha:rge during the execution of a program
are called "constants". If an attempt is made during the execution of a program to
change the value of a constant, an error is generated. The advantage of declaring
a value as a constant is that if a certain value must not change during the
execution of a program, and if the program contains a statement that attempts to
change this value, then an error is generated.
Syntar : Const constname [As <datatype>] = value
Example:
Const PI As Double = 3.142
Now, if the programmer accidentally writes a statement such as PI = Plf 2, an
error will be generated as PI has already been declared as a constant.
Heie are some more examples of constant declarations :
Const sngTaxRate As Single = O.3O
Const strWebSite As String = www.myexamnotes.com
Const intMaxMarks As Integer = 100
Visual Basic supports two types of constants :
l. Intrinsic constants
These are system defined constants (pre-defined). These constants need not
be declared and can be used directly. Intrinsic constants start with the prefix vb.
E.g., vbRed, vbCrlf are intrinsic constants.
Vriables, Constants and Calculations
r't"r' 107
2. Named Constants
These are declared by using the ke5nnord const. we give a name to the
constant, then the data t5pe, and finally a value. The value that is given to the
constant must match its data t5rpe. Once a value is given to tJ:e constant, it
cannot be changed during program execution. Example: Const Double pI =
3.L42, Ta:rRate = 0.30
Rules for forming constant identifiers :
The rules for forming identifier names for constants are the same as for
variables.
Data firpes :
We have already seen that variables and constants are declared before they
are used in a program. The declaration gives the name and data type of the
variable or constant. Th.e data tgpe of a uariable or a constant indicates utnt tgpe
of information wilt be stored in tle allocated memory space.
The data t5pe also decides the following :
o the range ofvalues that can be stored, and
a operations that can be carried out.
E.g., if we declare a variable as an integer, we can carrJr out the mathematical
operations such as addition, subtraction, etc. But if we declare a variable as a
string, we cannot carry out operations of multiplication, division, etc.
It is not necessary to declare a data type in the declaration statement (i.e.
Dim statement). The default data type is called as varlant. Thus, we can write a
declaration like this : Dim StreetName
Advantage of Variant data type : We can store any type of data in a variable
or constant that is of t5rye variant.
Dlsadvantage of varlant data typc : This data type is less eflicient than the
other data t5pes. Variants require more space in memory and operate less slowly
than the other data types.
Data t5rpes used in Visual Baslc :
The following table shows the different data types used in Visual Basic, their
purpose, the prefix used, number of bytes of memory allocated, and an example
of each.

Table 1 : Date T5rper urcd ln Vlrud Barlc


Data Purpore Preflx Numbcr of Example
Type (Urcd forf bytcr
Boolean True or false values bln 2 bLrPassed
Byte A single ASCII character byt I
Currency Decimal fraction such as rupees, cur 8 curCostPrice
paisa, dollars, and cents.
Date An eight-character date dtm 8 dtmHireDate
Double Double-precision floating point dbl 8 dbLArea
numbers (14 digits of accurary)
Integer Integers in the range -32768 to int 2 intRollNo
32767
Long Larger integers Raagc lr from lng 4 lngPopulation
2,147 1483,648 to 2,147r+:83164
(approx +(-f2 bllltoal
108 t't't" Computer Sgstems and Applications - T.Y.B.Com.-(Sem. VI)

Data hrrpose Prefh Itlumber of Example


Type (Used forf bytes
Single Single precision floating point sng 4 sngRadius
numbers urith 6 digit accuracy
String Alphanumeric data such as str 10 bytes + 1 strName
letters, digits, and other byte for each
characters character
Variant Converts from one data type to rmt 16 bytes to rmtMarks
another, as needed store numbers,
and 22 bytes +
I byte for each
character

VAL FUNCTION :

A function is a code that perforrns certain actions and returns or gives a


value. To do its calculations, a function needs an input; this is called as the
function argument and is written in brackets after the function name. In this
chapter we study the Val function. Most data entered through the keyboard goes
into a textbox. This is string data and must be converted into numeric data
before it can be used in calculations. To convert string (text) data into numeric
data we use the VAL function.
Purpose : It converts text data into numeric data.
Syntax : Val(texttoconvert)
The value returned by a function must be used in a statement, for example,
by assigning the return value to a variable.
Eramples:
intMarks = Val(bftMarks.Text)
curMRP = Val(txtMRP.Text)
How Val function works?
1. To convert tJre argument to a value, the VaI function begins at the left-most
character of the argument.
2. If the left-most character is a numeric digit, decimal point, or a sign (+ or -
sign), Val converts the character to numeric and moves to the next character.
3. As soon as a non-numeric character is found, t]le operation stops.
The following examples illustrate how tJ:e Val function returns a value :

Table 2 : Examples of Vd functlon


Statemeat Argument I[umerlc Vdue Explanation
returaed by the
Val function
Valo Blank/space o Space cannot be converted to a
value
Val(s65.s) 365.5 365.5 All characters are digits or a
decimal sign
Val(1,OO,OO0) 1,OO,OOO 1 Val stops at the comma sign
Val(AI3s9) 4I359 o The first character is non-numeric
Val(3sgAD 359AI 359 Conversion upto the last digit.
Vriable s, Constants and Calanlations ,'t"t' 109

Statemeat Argument Numeric Vdue Explanatioa


returaed by the
Val function
Val(+2931 +203 203 + is a sign so proceed & convert
remaining characters as they are
digits.
Val(-203) -203 -203 - is a sign so proceed & convert
remaining characters as they are
digits.
val(r2.67.891 12.67.89 12.67 First decimal point is considered
but conversion stops at the
second decimal point
Val(3 - 7) 3-7 -4 The argument is a mathematical
expression and it is evaluated.

ARITHMETIC OPERATIONS
The arithmetic operations that can be performed in Visual Basic are listed in
Table 3 below:
Table 3 : Arithmetic Operations
Operator Operation Order of precedence
Exponentiation 1

I Division 2
Multiplication 2
+ Addition 3
Subtraction 3

Order of Operations :
The order in which the operations are carried out determines the result. This
order of operations is also called the trierarchy' of operations. The hierarchy of
arithmetic operators or order of precedence is shown in Table 3.
Example 1
Determine the value of the following expression : 3 + 5 ^ 2
Since exponentiation (^) has the highest precedence, this operation must be
carried out first. So we get : 5^2 = 25, and then we carry out the addition 3 + 25
to give the result 28.
Example 2
Determine the value of the following expression : (3 + 5) " 2
Note how the order of precedence has now changed as 3 and 5 are both
inside the bracket. Expressions inside the bracket must be evaluated first
(remember the BODMAS rule t). So we get 3 + 5 = 8, and then 8 ^ 2 gives the
result 64.
Convetting mathenatical erpressions into equivaleat Visud Baslc
statements:
There are implied mathematical operations in Visual Basic. For example, xy
is valid in mathematics and means x multiplied by y. But this must be written
x * y.
with the multiplication sign in Visual Basic, as follows:
Table 4 below shows a few mathematical equations/expressions and their
equivalent in Visual Basic.

t
110 t?"tt. - T.Y.B.Com.-(Sem'
Computer Systems and Applications VI)

Table 4 : Some Mathematlcd expresslons aad thelr VB Equlvalent


Mathematicd Expression Vlsual Basic Equivdent
ax+b a*x+b
3.1412 3.14 * r^2
PNR/ lOO P*N*R/ 1OO
(x+y)(x-y) (x+y) *(x-y)
ab+cd a*b + c*d
X(x+1) X*(x+1)
FV = A(1+R)N FV=A*(1 +p1,r1
Formatting Deta : ,
Formatting data means to control the way it \rill look on the screen or paper.
After doing calculations, we may display the discounted price of an item as LOSO
or as < 1050. Obviously, the later is more meaningful.
Visual Basic has the following Format functions that can be used to control
how the output will appear :
1. FormatCurrcncy Functlon
Rrrpose : The FormatCurrency function returns a string of characters
formatted as dollars and cents. By default, the currency value displays the dollar
sign ($) but that can be changed from the Control Panel - Regional Settings
section. By default, values are rounded off to two decimal places. The value
returned by this function is no longer numeric and cannot be used for further
calculations.
S5rntar : FormatCurrency(value, number of decimal positions)
Exampler:
i) FormatCurrency(356.675) gives the output $356.68
i0 FormatCurrency(O.9) gives the output $O.90
iii) FormatCurrency(26.7823l,3) gives the result 26.782
2. F6rmatNumber Functlon
hrrpose : The FormatNumber function returns a string of characters
formatted with commas and a decimal digit. By default, two digits are displayed
to the right of the decimal point.
Syntar : FormatNumber(value, number of decimal positions)
Eramples:
0 FormatNumber(1356.675, O) gives the output L,357
ii) FormatNumber(1356.675, 2l gives the output 1,356.68
3. FornatPercenthrnctlon
Purpose : The FormatPercent function displays a numeric value as a percent.
This function multiplies the argument by 1o0, adds a percent sign, and rounds
the number to two decimal places.
S5rntar : FormatPercent(value, number of decimal positions)
Examples:
i) FormatPercent(O.85) returns the value 85o/o
ii) FormatPercent(0.85, 1) returns the value 85.0olo
iii) FormatPercent(O.852) returns the value 85%
Vriables, Constunrts and CaLanlations jl"11"t' 111

iv) FormatPercent(0.852, returns the value 85.2o/o


1)
v) FormatPercent(O.8s2, 2) returns the value 85.2Oo/o
vi) FormatPercent(l .29456,2) returns the value L23.46o/o
vii) FormatPercent(O .OO1234, 2) returns the value O.l2o/o
viii) FormatPercent( 1 2 345. 12, 2)returns the value L,234,5 12.OOo/o
4. FormatDateTime Functlon
Rrrpose : The FormatDateTime function is used to format an expression that
holds a date or a time value. The computer's regional settings are used to
determine how the date and time are formatted, the separator character, and
whether to use the 12 hour or 2 hour clock.
Syntar : FormatDateTime(expression-to-format, [named format] )
If the named format is omitted, the function returns the date formatted using
vbGeneralDate.
Naned Formats : The named format can be one of the following :
ubGeneralDate - Returns a date xtd/or time. If the expression is a date,
returns a short date. If it holds a time, returns a long time.
If it holds both, returns both a short date and a long time.
8.g., 9 / 22 I 2OO9 5:03: 18 AM
ubLongDate - Returns day of the week, Month, Day and Year.
E.g., T\resday, September 22, 2OO9. The exact format
depends on regional settings.
ubSlwrtDate - Returns date in the format MM/DD/YY.E.g., 9l22l2OO9
ubLongTime - Returns time in the format HH:MM:SS AM/PM. E.9.,
5:06:38 AM
ubSlortTime - Returns time in the format HH:MM (24 }:o:ut clock). E.g.,
17:08
PROGRAUUIITG EXTRCISES
1. Exchange Vdues of Two Variables :
Create a project that allows the user to enter two numbers in text boxes. The
program should exchange the contents of the two variables by using a third
temporar5r variable.
Program Logic :
i) We accept two numbers in variables, say A and B-
ii) We create a third variable, say Temp.
iii) We store the value of A in Temp; to do this, we use the statement
Temp = A.
iv) Now the value of A is also available in another variable called Temp.
v) Next, store the value of B in A; this is done by tJ:e statement A = B. Note,
that the value of A was previously stored in Temp, so A's old value is still
available.
vi) Finally, copy the value of Temp to B; this is done by the statement
B = Temp. Effectively, we are copying the old value of A into B.
112 3l't'l," Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

Form Deslgn :
r [xchange Vdlues
lblBefore Befd6 ErchsrEF lblNum2

lblNuml Nunba 1 Nw$.r 2


brtNum2
tsftNum1
lblNum4
lblAfter Afta E xcirange

lblNum3 Nmbs 1 Nqrbor 2 tsrtNum4


OGNum3

ged cmdExit
cmdExchange Exchalge

cmdClear

Ftg.9.1 : Form Design for Erchaage of tso variablee


ObJects and their Properties :

Object Property Value


Form Name frmExchange
Caption Exchange Values
Label Name lblBefore
Caption Before Exchange
Label Name lb1Numl
Caption Number 1
Text Box Name txtNuml
Text "" (blank)
Label Name lblNum2
Caption Number 2
Text Box Name txtNum2
Caption "" (blank)
Label Name lbLAfter
Caption After Exchange
Label Name lblNum3
Caption Number I
Text Box Name txtNum3
Text "" (blank)
Enabled False
Label Name lblNum3
Caption Number 2
Text Box Name txtNum4
Caption "" (blank)
Enabled False
Command Button Name cmdExchange
Caption &Exchange
Command Button Name cmdClear
Caption &Clear
Command Button Name cmdExit
Caption E&xit
Vriables, Constants and Calculations t't't' 113

Note : We have set the Enabled property of Text boxes txtNum3 and txtNum4 to
'False' so that user cannot type anything in these text boxes. Values of these text
boxes are generated by our progr€rm
Event Procedures :

Event Procedure Actions - Pseudocode


cmdExchange-Click0 a Dimension the variables
a Convert text box values to numeric
a Exchange values using a temporar5r variable
a Display the new values in the text boxes
cmdClear-Click0 a Set each text box to blank
a Set focus to textbox txtNuml
cmdExit-Click0 End the program
ProJect Code :
Private Sub cmdClear_Cltck(f
'clear the text boxes and set focus on the first text box
txtNuml.Text = ""
txtNum2.Text = ""
txtNum3.Text = ""
txtNum4.Text = ""

txtNuml.SetFocus 'set tlle cursor into the txtNuml text box


End Sub

Private Sub cmdExchange-Cltck(l


Dim Temp As Integer
Dim A, B As Integer

A = Val(txtNuml.Text) 'store the original value of first number


B = Val(txtNum2.Text) 'store the original value of second number

'exchange the two numbers


Temp = A
A=B
B = Temp

'display the new values in the text boxes


txtNum3,Text = A
txtNum4.Text = B
Sub

Sub cmdExit-Cltck(f
End
End Sub
114 t t computer $ystems andApplications-T.Y.B.com.-(Sem. VI)

2. To calculate the 'o Average MarLs ln Thrce SubJects :


Create a project that allows the user to enter the marks scored by a student
in three subjects. The program should calculate the average marks and display
the result formatted with two decimd places.
Program Loglc :
i) We accept three marks in three text boxes.
ii) We convert these marks to integers numeric values by using the Va10
function.
iii) We create avariable called avg of data type Single.
iv) Calculate the average of these three numbers and store in avg.
v) Finally, we display the average value in a text box whose Enabled
property is set to False.
Form Deslgn:
r Average Marks l ItrItrl
lblMksl bftMks1

lblMI<s2
u.tMks2

lblMks3 bcMks3

tsrtAvg
lblAvg

cmdAvg cmdExit

cmdClear

F19,.9.2: Forrn Dosign for Cdculating thc Average of Three MarLs


ObJects and thelr Properties :
ObJect Property Value ObJect Property Value
Form Name frmAverage Text Box Name txtMks3
Caption Average Marks Text "" (blank)
Label Name lblMksl Label Name lb[Average
Caption Marks I Caption Average
Text Box Name txtMksl Text Box Name txtAvg
Text "" (blank) Text "" (blank)
Label Name lblMks2 Enabled False
Caption Marks 2 Command Name cmdAvg
Button
Text Box Name txtMks2 Caption &Average
Caption "" (blank) Command Name cmdClear
Button
Label Name lblMks3 Caption &Clear
Caption Marks 3 Command Name cmdExit
Button
Caption E&xit
Vriables, Con stants and Calculations t'lr't' 115

Event Procedures :

Event Procedure Actions - Pseudocode


cmdAverage_Click0 a Dimension the variables
o Convert text box values to numeric
a Calculate the average, formatted with 2 decimal
places. Use FormatNumber function.
. Display the new values in the text box.
cmdClear-Click0 a Set each text box to blank
a Set focus to textbox txtMksl
cmdExit-Click0 End tJle program

ProJect Code :
Prlvate Sub cmdAvgClick(f
Dim A, B, C As Integer
Dim avg As Single

A = Val(txtMksl.Text)
B = Val(txtMks2.Text)
C = Val(txtMks3.Text)

avg=(A+B+C) /3

b<tAvg.Text = FormatNumber(avg, 2)
End Sub

Hvate Sub cmdClear-Click()


txtMksl.Text = ""
txtMks2.Text = ""
txtMks3.Text = ""
txtAvg.Text = ""

txtMks l.SetFocus
End Sub

Prlvate Sub cmdExit-Cltck(f


End
End Sub
3. Slmple latcrest Cdculatlon :
Create a project that calculates the simple interest (I) earned on a principal
deposit of t P, t<ept in a bank for time period T years, if it earns an interest at the
rate oftR per year. Also calculate the total amount due after T years. Total
amount due is the sum of principal amount (P) and the interest earned (I) during
this time.
output should be formatted using the Formatcurrency function'
9/T.Y.B.Cori - Com. Sys. & Appl. (Sem. - VI)
116 computer systems and Applications - T.Y.B.Com.-(sem. vI)
t,t,t,
Program Logic :
i) We accept the inputs for P, R and T in three text boxes'
ii) We convert these text values into numeric values by using the Val0
function.
iii) We create a variable called I of data type Single.
iv) Calculate the simple interest earned; Formula is I = PRT/ 1O0
v) Calculate the total amount due as A = P + I
vi) Finally, we display the interest earned and total amount due in text boxes
whose Enabled property are set to False.
Form Design :
6----r
r Simple lnterest E] trl
lblPrn Principalfunou* bCPrn

lblTime No. olYears b<tYrs

lblRate b(tRate
lrterest Rde

lbllntAmt
lr*€rest Adpur* bclntAmt

lblTotal
TdalAmount b<tTotal

cmdCalculate cmdExit
Cdculate I C!ear Exit
I

cmdClear

Ftg. 9.3 : Form Design for Calculattng Simple Interest


ObJects and their Properties :
ObJect Property Value Object Property Value
Form Name frmExl Text Box Name txtlntAmt
Caption Text '"(blank)
Label Name lblPrn Enabled False
Caption Principal Amount Label Name lblTotal
Text Box Name txtPrn Caption Tota]
Amount
Text "" (blank) Text Box Name txtTotal
Label Name lblTime Text "" (blank)
Caption No. ofYears Enabled False
Text Box Name txtYrs Command Button Name cmdCalc
Caption "" (blank) Caption &Calculate
Label Name lblRate Command Button Name cmdClear
Caption Interest. Rate Caption C&lear
Text Box Name txtRate Command Button Name cmdExit
Text "" (blank) Caption E&xit
Label Name lbllntAmt
Caption Interest Amount
Viables, Constants and Calculations r?'r' 117

Event Procedures :
Event Procedure Actions - Pseudocode
cmdCalculate_Click0 o Dimension the variables
a Convert text box values to numeric
o Calculate the simple interest by using the formula
I = PRT/100, and Total amount due = P + I
o Display the new values in the text boxes for interest and
amount.
cmdClear_Click0 o Clear the text boxes by setting their Tqrt propert5r to ""
(blank)
o Set focus back to first text box
cmdExit_Click0 End the program

ProJect Code :
Private Sub cmdCdc-Click(f
Dim P, I, R, T, Total As Single

P = Val(txtPrn.Text) 'principal amount


R = Val(txtRate.Text) 'interest rate
T = Val(txtYrs.Text) 'time period in years

I=P*R*T / IOO

txtlntAmt.Text = FormatCurrency(I, 2)
txtTotal.Text = FormatCurrency(P + I, 2)

End Sub
Private Sub cndClear-Cllct(f
txtPrn.Text = ""
txtYrs.Text = ""
txtRate.Text = ""
txtlntAmt.Text = uu
txtTotal.Text = ""

txtPrn.SetFocus
End Sub

Private Sub cmdtxit-Click(!


End
End Sub
118 n't"l,' Computer Syslems and Applications - T.Y.B.Com.-(Sem. VI)

OBJECTIVE
I. State whether the followirg are tnre or false :
1. All variables must be compulsorily declared in a Visual Basic program.
2. A declaration statement begins with the keyword Dim.
3. More than one variable can be declared in a single declaration statement.
4. The declaration statement is an executable statement.
5. The name given to a variable is also called an identifier.
6. The type of data must be specilied in a declaration statement.
7. The Single data type is used to store words or phrases.
8. The Date data type occupies 10 bytes of memory.
9. The Integer data t5pe occupies one byte for each digit in the number. E.g., the
number 367 will require 3 bytes.
10. The variant data type is the most efficient of all data types.
1 1. The output of Val(3 + 7) is 3

12. T}:e value returned by the FormatCurrency function is non-numeric.


13. The output of formatting functions depends on the regional settings.
14. Once a value is assigned to a variable it cannot be changed.
il. Multiple Cholce Questions
Select the most approprlate alternatlve from amongst those glve! and rewrlte
the sentence :
1. The syntax for declaring a variable in VE! is
a) Dim variablename b) Dim variablename [As Type]
c) Either a or b above d) None of the above
2. The data type that hold the numeric variable with values ranging from O to 255 is
a) Byte b) Boolean
c) Single d) Integer
3. A general purpose variable that can hold most other t5pes of variable value is
a) String b) Integer
c) Currency d) Variant
4. Relational operator for "Not Equal to" is

c) =NOT d) NoT=
5. '^' is the operator for performing the arithmetic operation.
a) Addition b) Multiplication
c) Subtraction d) Exponentiation
6. enforces the variable declaration before they are used.
a) Option Explicit b) Option Implicit
c) REM d) None ofthe above
7. which of the following statements is most appropriate for a variable :
a) It is a memory location that holds data that can be changed during the execution
of a program.
b) A name and a data type is associated with every variable.
c) Declaring a variable means specitring its data type.
d) A11 ofthe above.
8. Which of the following is appropriate variable name to store the marks obtained by a
student?
a) intMks b) 3MarksAccts
c) Marks+Accts d) M
Vriables, Constnnts and Catculations t't r' 11g
9. Which of the following statements is the correct way to declare a constant TAXRATE
that stores the value O.3O?
a) Const TAXRATE As Single = O.3O
b) Const TAXRATE As Single O.3O
c) Const TAXRATE = 0.30
d) TAXRATE = O.3O
10. The data t5rpe of a variable decides :
a) The range ofvalues that can be stored
b) The operations that can be carried out on that variable
c) The amount of memory that will be allocated to that variable
d) All of the above
I 1. Which of these is a disadvantage of variant data type?
a) We can store any type of data in a variant type variable.
b) It occupies the least amount of memory.
c) They operate less slowly than other data types.
d) Variant type variables need not be declared before use.
12. Which of the following named formats will return the day of the week, month and
year ofa given date?
a) vbGeneralDate b) vblongDate,
c) vbSortDate d) vbFullDate
ANSWERS
I. [True : 2, 3, 5,6, 8, 13
Fdse z l, 4,7,9, lO, ll, 1.2, 141
U. [(1-b), (2-a), (3-d), (4-b), (5-d), (6-a), (7-d), (8-a), (9-a), (10-d), (11-c),
(12 - b)l

QUESTTONS
1. What is a variable?
2. What are the rules for forming identifier narnes for variables?
3. Which of the following identifiers are valid as per the naming convention in Visual
Basic?
(a) strGrade, (b) curMRP, (c) Discount, (d) int.Marks, (e) sng@Amount, (0 Private,
(g) Form, (h) blnPassed, (i) 23intRank, fi) lng-Population
4. What are constants? What is the advantage of declaring a value as a constant?
5. State the types of constants used in Visual Basic. Give one example of each.
6. Write a declaration for the following situations; create an appropriate variable
identifier.
a) Integer number of days attended college
b) Single-precision number of hours
c) Mobile Telephone number (not used in calculations)
d) String address ofa person
e) PINCODE of the area in which your college is situated
7. What is the purpose of the VaI function?
8. State the mathematical operations in Visual Basic.
9. Explain the order of precedence of operators for calculations. How can this order be
changed?
lO. State the value of each of the following expressions :
a) 3*2+7*8
b) 1614.^2+8
c) 6 +3*8/(2+61

\
120 r?'I' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

11. What is formatting of data?


12. State the different Format functions available in Visual Basic.
13. State the named formats for FormatDateTime function.
14. State the output of ttre following:
a) val($2s)
b) FormatCurrency(1235.667, Ol
c) FormatPercent(0.867586, 3)
d) FormatNumber(0.867586, 3)
e) FormatDateTime("9/23 I 2OO9, vblongDate)
15. Write short notes on :
a) FormatCurrency function
b) FormatPercentfunction
c) FormatDateTime function
d) FormatNumberfunction
16 What is the dilference between integer and long integer?
17 What is the difference between FormatCurrency and FormatNumber?
18 What is the purpose of the Dim statement in Visual Basic programs?

PRACTICAL EXERCISES
l. Create a project that determines the future value of an investment. The time period,
principal amount and interest rate will be input by the user. Display the future value
in a label, formatted as currency.
2. Write a complete progrurm that displays the message "l love Visual Basic" in the
caption of the label lblOutput when the user clicks the command button cmdClick.
3. Write a project in VB to design a suitable form to add two numbers and display their
sum.

,'t't'
D e cisio ns and Co nditio ns *'n?' 121

lo Decisions and Conditions

INTRODUCTION
A computer program must be able to take a decision based on certain
conditions and then execute statements based on the outcome of that condition;
if the condition is true, execute one set of statements, otherwise execute another
set of statements. This ability to take a decision is implemented in Visual Basic
through many decision making statements and conditions.
Control Structures :

Control statements are used to control the flow of execution in a program.


Visual Basic supports the following control structures :
i) Decision statements such as :

a) If...Then statement
b) If...Then... Else statement
c) If ... Then...Elseif statement
d) Select... Case statement
ii) Loop structures such as:
a) Do...While loop
b) While...Wend
c) For... Next loop
In this chapter we shall explore the If...Then statements and their use in
programs. But before that we study about the relational operators in Visual Basic
as these are required to form the decision statements such as If... Then and its
variations.
Relational Operators
A relational operator gives a relation between its operands. E.g., when we
write 2 . 3, t]ne operands are 2 arrd 3; the relational operator is the less than'
sign (<). The expression 2 < 3 is called a relational expression and it can give only
two possible results: True or False. Thus, whenever a relational operator is used
the result of the expression is either True or False.
The following table summarizes the six relational operators used in Visua1
Basic.
122 t't"t" Computer Sgstems and Applicatians - T.Y.B.Com-(Sem. VI)

Table I : Relatioaal Opcrators


Operator Relation Tested Example
Greater than A>B
Val(txtMks.Text) > avg
Less than Va1(txtBasic.Text) < 10000
Equal to txtPassword.Text = "success'
optMale.Value = True
Not equal to brtPassword.Text < > "success"
optButtonl.Value <> True
Greater than or equal to txtHeight.text >= L67
less than or equal to txtMarks <= 34
Relational operators can be used between operands of the same data type.
E.g. numeric data type can be compared with another numeric data type
operand. String data types can be compared with each other; we cannot compare
a string operand with an integer operand.
?HE IF ...THEN STATEMENT :

Purpose : Execute a set of statements if a given condition is true.


Syntax:
If <condition> Then FALSE
CONDMON
Statement- 1(s)
End If TRUE
Example 1 :
If A > B Then STATEMENTS
TOBEEXECUTM
MsgBox "A is greater" IFCONDMON
End if
Example 2 :
Ifaverage >= 60 Then
txtResult.Text = "First Class"
End if rig. 10.r
THE IF ...THEN ... ELSE STATEMENT :

hrrpose : Execute a set of statements if a given condition is true, otherwise


execute another set of statements.
Syntax:
If <condition> Then
Statement-1(s)
Else
Statement-2(s) TRI.'E FALSE
CONDMON?
End If
Example I : ONE
STATEMENTS
ONEORMORE
STATEMENTS
IfA>BThen TOBEE,(ECUIED
IFCONDIIION
TOBEE)(ECUTED
IFMNDITION
Max=A IS TRUE ISFALSE

Else
Max=B
End if Ftg. 1O.2
Decisions and Condition s ft"C 123

Erample 2 :
Ifaverage >= Then
5O
txtResult.Text ='Pass"
Else
brtResult.Text = "Fail'
End if
THE NESTED IF ...THEN ... ELSIE STATEMEITT :

hrrpoce : Nested If...Then...Else selection structures test for multiple cases


by placing If...Then...Else selection structures inside If...Then...Else structures.
Syntar:
If <condition 1> Then
statements
Elself <condition 2> Then
statements
Elself <condition 3> Then
statements
Else
statements
End If
Example 1:
Ifaverage >= 75 Then
txtGrade.Text = "Distinction"
Elself average >= 6O Then
txtGrade.Text = "First Class"
Elself average >= 45 Then
txtGrade.text = "Second Class"
Elself average >= 40 Then
txtGrade.Text = "Pass Class"
Else
txtGrade.Text = "Fail"
End If
A nested If statement is an If statement inside another If statement. E.g., you
may want to divide a number x by y only if y is not equal to zeto.
If optDivision.Value = True Then
IfY"0Then
z=x /y
Else
'Report an error
MsgBox "Cannot divide by zero", vbCritical, "Error"
End If
End If

A
&\
124 t"r't" Com4ruter Sgstems and Applications -T.Y.B.Com.-(Sem. VI)

COMPARING NUMERIC VALUES :

When a numeric data is involved in comparison, an algebraic expression is


made. The sign and magnitude of the numbers is taken into account. Therefore,
-10 is less than 5. Similarly, -7 is less than -2. To remember this, just remember
the number line that you studied in school mathematics. In the number line
shown below, numbers to the left of a give number are smaller while those on the
right are bigger.

T T
l T
4 -3 -2 -1 o 1 2 3 4

Examples
1. Write the statements necessary to compare txtNuml.Text and txtNum2.Text.
Display in lblMax.Caption, which has more value.
Ans. : If txtNuml.Text > txtNum2.Text Then
lblMax.Caption "Num1 is greater than Num2"
Else
lblMax.Caption "Num2 is greater than Num1"
End If
2. Write statements that allow the user to type an integer in a text box. Print
the number of digits in the number. Assume that the number entered is
between 1 and 1000.
Ans:
N = Vaf(txtNumber.Text)
IfN<10Then
digits = 1
Elself number < 100 Then
digits = 2
Else
digits = 3
End If
lblDigits.value = digits
ASCII Code :
ASCII is the abbreviation for American Standard Code for Information
Interchange. Every character has a unique numeric code associated with it. For
example, the character 'A'has the ASCII code 65, B, has the ASCII code has 66,
etc. The following table gives the ASCII codes for alphabets and digits :
ASCII Code Range Character Raage
48-57 Digits O - 9
65-90 Letters A - Z
97 - L22 Letters a - z
Thus:
a) All numeric digits are less than all letters.
b) Since the ASCII code of A is less than that of B, A < B.
c) Uppercase letters are less than lowercase letters.
Decisions and. Cortditiorc ,ntnjln 125
Comparing Strings
Comparison of string variables begins with the left-most character and
procieds one character at a time from left to right. As soon as the character in
one string is not equal to the corresponding character in the second string, the
comparison ends. The string which has a character with smaller ASCII code is
said to be smaller than the other string.
Eramples:
1. comparison of "RAM" and "RoM". RAM is less than RoM as A has the
smaller ASCII code of 65.
2. Comparison of 203PDR with PDR. If the digit 2 is compared with the letter P,
2 is lower since all numbers have lower ASCII codes.
Comparing Text Propett5r of Tert Boxes :
Visual Basic compares one text box to another as strings. We can carry out a
numeric comparison on Text property by using the Val function. The following
table shows a few examples of comparing numbers in text boxes.
txtNuml.Text txtNum2.Text txtNuml.Text Val(txtNuml.Text)
txtNum2.Text Val(txtNum2.Text)
1 +1 True False
ASCII code of 1 is Val of both text boxes is
greater than the ASCII the same, so they are
code of the + sign equal.
0 (blank) True False
ASCII value of 0 is Val converts blank to 0,
greater than that of so both are equal.
space (blank)

COMPOUND CONDITIONS AND LOGICAL OPERATORS :

TWo or more conditions joined by logical operators form a compound


condition. The logical operators are And, Or and Not.
Logicd Meanlng Example
Operator
And Both conditions must be txtMarks.Text >= O And txtMarks.Text <= 100
true for the entire condition
to be True.
Or At least one of the txtMarks.Text >= 6O Or txtGrade.Text = 'A'
conditions must be true.
Not Reverses a condition so that Not lblGrade = F'
a T\re condition becomes
False and vice-versa.
Using If Statements with Option Buttons And Check Boxes
The Click$ event is the most important event for option buttons and check
boxes. When a user clicks on an option button or check box, tlle code that
appears in the Clickfl event of that object is executed. But it is a good
progrermming practice to put this code in the Click$ event of a command button
rather than the option button/check box. The reason for this is: a user may click
on an option button, but may wish to change the option. The If statement can be
126 Computer Sgstcms andApplimtions -T.Y.B.Com-(Sem- VI)

placed in the clickfl event of the command button. This If statement can check
which options were selected.
Here is a simple progrErm that checks the value of an option button.
Eranple I : To Test the Value of an Optlon Button
Create a project that contains three option buttons labeled "Commerce",
oArts", "Sciencl", a label, and two command buttons with captions "Show" and
"Exit". The user selects one of the options and on clicking the Show command
button, the r-nessage "You selected ----- facult5f should be displayed as the
caption of the label- The dash (-----) is replaced by the option selected. E.g., "You
selected Commerce facult5/.
Form Deslgn :
r Oplion Sullon lf Stmt f:ttE It
fraFaculty
optCom

optArts
Sc*re
optSc

lblFaculty

cmdShow Edt cmdExit

rE. 1O.3
Objects and thelr Propettles :
ObJect Property Value
Form Name frmlnterest
Caption Option Button-If Stmt
Frame Name fraFaculty
Caption Faculty
Option Button Name optCom
Option Button Name optArts
Option Button Name optSc
Label Name lblFaculty
Caption "" (blank)
Command Button Name cmdShow
Caption S&how
Command Button Name cmdExit
Caption &Exit
Event Procedures :

Event Procedure Actlons - Pseudocode


cmdForm_Load0 Set the values of all option buttons to False
cmdShow_Click0 o Use the If statement to check which option button has a True
value (i.e. clicked)
o Display a message in the label object
cmdExit_Click0 End the program
Decision s and Conditions t'l''t' 127
ProJect Code :
Hvate Sub Form_Load(f
optCom.Value = False
optArts.Value = False
optSc.Value = False
Erid Sub

Hvate Sub cmdShow_CltcL(f


If optCom.Value = True Then
lblFaculty.Caption = "You selected " & "Commerce" & " Faculty"
Elself optArts.Value = True Then
lblFaculty.Caption = "You selected " & "Arts' & " Facult5/"
Elself optSc.Value = True Then
lblFaculty.Caption = "You selected " & "Science" & " Facult5r"
End If
End Sub

Private Sub cmdErit_Click(f


End
End Sub

Example 2 z To Test the Value of A Check Bor :


Create a project that contains a check box, a label and two command
buttons. Name one command button cmdTest, the other cmdExit, check box is
named chkTest, and the label is named lblMesage. In the click$ event of the
cmdTest button, check the value of the check box. If the check box is currently
checked, display the message "Check Box is checked" in lblMessage.
We give here only the code for the cmdTest button's Click$ event. The
student is encouraged to develop the rest of the project on her own.
Hvate Sub cndTest_Cllck(f
If chkTest.Value = Checked Then
lblMessage.Caption = "Check Box is checked"
End If
End Sub
Message Box
A message box is a special type of window in Visual Basic. It displays a
message and then waits for the user to click a button. It then returns an integer
indicating which button was clicked.
Syntar:
MsgBox "message" [, buttons/icon] [caption of title bar]
A message box has the following components :
i) a message,
. ii) an icon,
iii) a title bar caption, and
iv) one or more command buttons.
128 f't'1" Computer Sysfems andApplications-T.Y.B.Com.-(Sem. VI)

The button part is optional; it determines which command buttons will be


displayed. The default button is the OK button and it is displayed if the button
part is not given.
Title bar caption

Icon Message
Thisb an exa$b d a
'- a-
Buttorr Csrcel

Ftg. 1O.4
To display the buttons, we can use the following intrinsic constants of Visual
Basic.
Constant Vdue Button(sf displayed
vbOKOnly 0 OK button
vbOKCancel 1 OK and Cancel buttons
vbAbortRetryIgnore 2 Abort, Retry, and Ignore buttons
vbYesNoCancel 3 Yes, No, and Cancel buttons
vbYesNo 4 Yes and No buttons
vbRetryCancel 5 Retry and Cancel buttons.
vbCrtical 16 Critical Message Icon E
vbQuestion 32 Question mark
g
vbExclamation 48 Warning Message icon tr
vblnformation 64 Information message icon e
If the title bar caption is omitted, it will display the project name in the
message box title bar.
A message box can be used to display a message when the user has entered
invalid input.
Example :
If txtMarks.Text = "" Then
MsgBox "Please enter marks". vbOkOnly, "Marks Not Entered"
Endif
Input Validation
Input validation means checking whether the data input by the user is
correct or not. Validation may include checking for the following :
i) check that data is numeric
ii) check that data is in a particular r€rnge
iii) check that a field has not been left blank
Checking for Numeric Values wlth the IsNumeric function :
The IsNumericfl function of Visual Basic checks whether its argument is
numeric or not. This function returns the value True if its argument is numeric,
else it returns False. This function can be used to check whether the data can be
converted to a number for calculations, otherwise an error message can be
displayed.
Syntax:
IsNumeric (expression)
Decisions and Conditions t"rnto 12g
Erample:
If IsNumeric(txtMarks.Text) Then
Mks = Val(txtMarks.Text)
Else
MsgBox "Nonnumeric data entered", vbokonly, "Invalid Data"
End If
Checklng for a rangc of values :
Data validation may inclucie cheeLi.rs, t}at data cntered is within a certain
range - e.9., marks are between 0 and 10O.
Example:
Mks = Val(txtMarks.Text)
If Mks >= 0 And Mks <= l0O Then
Total=Total+Mks
Else
MsgBox "Marks must be in the range 0 - 10o", vbokonly, "Invalid Data"
End If
Checkiag for a Requlred Field (Field not left blankf :
If we want to ensure that a text box has not been left blank, we can compare
the text box value to an empty string.
Erample:
If txtMarks.Text = "" Then
MsgBox "Please enter a value", vbOkOnly, "Blank Field"
Else
Total = Total + Val(txtMarks.Text)
End If
PROGRAMMING EXRCISES
1. Maximum of three integers
Create a project that computes the maximum of three integers entered by the
user. Display the result in a message box.
Form Design :
i Ldrgesl of 3 Nos l; lln ilt I

ffi
lt
I
I

I
I

I
I

FindMu I
I *. l_E* |

Flg. lO.5
Event Procedures :
Event Procedure Actlons - Pscudocode
cmdMax-Click0 Compares the numbers and finds their maximum. Displays result
lna box.
cmdClear_Click0 Clears the text boxes and positions the cursor in the first text box.
cmdExit-Click0 End the program
130 3l"t''. Compfier Systems and Applications - T.Y.B.Com.-(Sem. VI)

ProJect Code :
Hvate Sub emdMax-Cltck(l
Dim A, B, C, Max As Integer

A = Val(b<tNuml.Text)
B = Val(txtNum2.Text)
C = Val(b<tNumS.Text)
'first find the larger of A and B
lfA>=BThen
Max=A
Else
Man=B
End If

lf C >= Max Then


Ma:r = C
End If

MsgBox "Largest number is " & Ma:r, vbOKOnly, "Maximum Number"


End Sub

Hvate Sub cmdClear_CltcL(f


txtNuml.Text = ""
txtNum2.Text = ""
txtNum3.Text = "" )

txtNuml.SetFocus
End Sub

Hvate Sub cndErlt_CltcL(f


End
End Sub
2. Chect for even or odd aunbcr
Accept a number from the user and check whether it is even or odd
Form Dcrlga :

r Folnrl EtrIIA
Nur&ar

l:l:
et^Eck
l: Ch" l: Ed

Ftg. 10.6
Deci.sbn s and Condilions t,'t't" 131

ProJect Code :

Hvate Sub cndCheck_Cltck(f


Dim N As Integer

N = Va1(txtNum.Text)

'Mod operator gives remainder after division.


'If remainder after dividing by 2 is 0, then number is even
'otherwise the number is odd
IfNMod2=OThen
MsgBox "Number entered is Even", vbOKOnly
Else
MsgBox "Number entered is Odd", vbOKOnly
End If
End Sub

Hvate Sub cmdClear_Cltck(f


'clear the text box and place cursor back in the text box
txtNum.Text = ""
txtNum.SetFocus
End Sub

Prlvate Sub cmdExit-Click(l


End
End Sub
3. To check whether a number ls greater than O or less than O.
Accept a number from the user and check whether it is greater than 0 or less
than 0. This also tests whether the number is positive or negative.

r Fr:rtn1

Eh€ck CIear

Ftg. lO.7

l0/T.Y.B.Com - Com. Sys. & Appl. (Sem. - VI)


132 t't't' Computer Sysfems and Applications - T.Y.B.Com-(Sem. VI)

ProJect Code :
Hvate Sub crndCheck-Cltck(l
Dim N As Integer

N = Val(txtNum.Text)

If N > 0 Then
MsgBox "Number entered is positivb (greater than O)", vbOKOnly
ElselfN<OThen
MsgBox "Number entered is negative (less than 0)", vbOKOnly
Else
MsgBox "Number entered is 0", vbOKOnly
End If
End Sub

Hvate Sub cmdClear-Click(f


'clear the text box and place cursor back in the text box
txtNum.Text = ""
txtNum.SetFocus
End Sub

Hvate Sub cmdErit-Clickfl


End
End Sub

OBJECTWE QUESTIONS
I. State whether the following are true or false :
1. The purpose of control statements is to control the flow of execution in a program.
2. Relational operators can be used between operands of same data type only.
3. Whenever a relational operator is used, the result of operation is either O or 1.
4. If statement cannot be nested inside another If statement.
5. Comparison of strings is done by using the ASCII code.
n. Multlple Cholce Questions
Select the most appropriate alternative from amongst those glven and rewrlte
the sentence :
1. Which of the following statements is most appropriate for relational operators :
a) They can only be used to compare operands of the same data t5pe.
b) They can be used to compare only numeric data types such as integer and string.
c) They can be used to compare only string data gqpes.
d) The relational operator for "not equal to" is !=
2. The ASCII code of alphabets is _ than that of digits O to 9.
a) Less than
b) Greater than
c) Depends on whether it is lower case or upper case alphabet
d) Cannot be said with certainty
Decisions and Conditions t.t"3;" 133
3. What is the purpose of the if...then statement?
a) To execute a set of statements
b) To check a condition, and if it is false, execute a set of statements
c) To check a condition, and if it is true, execute a set of statements
d) To check a condition and if it is true, execute one set of statements otherwise
execute another set of statements.
4. What is the purpose of the if...then...else statement?
a) To execute a set of statements
b) To check a condition, and if it is false, execute a set of statements
c) To check a condition, and if it is true, execute a set of statements
d) To check a condition and if it is true, execute one set of statements otherwise
execute another set of statements.

lANswEREl
I. True : 1,2,5
Fdce:3,4
III. [(1 - a), (2 -bl, (3 - c), (4 - d)]

lauEstrousl
1. State the relational operators in Visual Basic.
2. What are logical operators? Explain their purpose in Visual Basic.
3. Explain, with a suitable example, the If..Then statement in Visual Basic.
4. Explain, with a suitable example, the lf..Then...Else statement in Visual Basic
5. What is the nested If...Then statement? Explain with an example.
6. Explain, with a suitable example, how Visual Basic compares numeric data.
7. Explain, with a suitable example, how Visual Basic compares string data.
8. What is the ASCII code?
9. What is a message box? When is it useful?
10. Give an example of three message box constants.
1 1. What are the components of a message box?
12. What is mea:rt by the term "validation"?
13. What are the different types of validation?
14. Explain each of the following validations, with an example:
a) Range checking
b) Check for numeric data
c) Check that a field has not been left blank

PRACTICAL EXERCISES
1. a) Suppose the variable paA has been assigned the value of 6.50. Test the value of
variable laurs. If hours exceed 40, assign the value of 9.75 to pag.
b) Test the value of variable hours. If hours is less than or equal to 40, assign 6.O0
to pay and assign "Regular" to string variable status. If pay exceeds 40, assign
9.75 to pay and assign "Overtime" to status.
2. Suppose the variable age has been declared as an integer variable. Test the value of
age and if it is 18 or more, display the message "You are old enough to marr5/ in a
message box.
3. Suppose the variable age and gender are declared as integer and character type
respectively. Take the input from the user and declare the person as eligible for
marriage based on the following conditions: If gender is female and age is 18 years or
134 t't"t' Computer Sgstem.s and Applications - T.Y.B.Com--(Sem. VI)
more, the person is eligible to marry. If gender is male and age is 21 years or more,
person is eligible to marry. In all other cases, person cannot marry.
4. Ask the user to enter the marks obtained in an exam from 0 to 1OO. Display the
grade it represents - First class (60 or more), second class (45 - 59) and pass class
(40-441. Grade is Fail if mark is below 40.
5. Ask a salesperson to input the total value of sales. this year. If it exceeds { 1 lakh, the
bonus is t 10,000. If it is from { 70,000 to T 99,999, bonus is { 7,OOO and if it is Rs
5O,OOO to t 69,999 the bonus is ( 4,000. Sales less than t 50,000 receive no bonus.
6. Create a Visual Basic Project that will allow the user to enter a positive number and
determine whether it is odd or even.

t"t't"
Introduction to Visual Basic Controls
t't"t' 135

ll fntuoduction to
Yisuol Bosic Controls

INTRODUCTION
Visual Basic is a programming language through which we can create
programs with a graphical user interface. All the Microsoft Office products such
as Microsoft word, Excel, PowerPoint, etc. that we use have a graphical user
interface.
Programs with graphical user interface are made up of components like text
box, command button, label, check box, list box, combo box, frame, option
button, line, shape, image, etc. These components are called the GUI
components. Visual Basic also contains these components to be used in our
programs. Each of these objects has properties, methods, and events.
Controlr are used to get user input and to display output. E.g., text box,
label, check box, list box, combo box, are all controls.
Propertles of an object are the characteristics used to describe the object.
They tell us something about an object such as its name, size, color, location on
the screen. Certain properties can be changed at design time but others can only
be modified at run time. All controls have certain default properties.
Methodc are code executed by the program. E.g., Addltem and Removeltem
are methods associated with a list box.
Events : An event. is an action recognized by a form or a control. When a
particular event takes place, the code for that event is executed. Examples are
clicking the mouse, pressing a key, etc.
o Events need not necessarily be triggered by the user. They may be
triggered by other events also.
o The components of Visual Basic have built-in code that helps them to
recognize events.
o An interface component can recognize more than one event.
a The progrEunmer determines the response of a component to a particular
event by writing the necessary code.
o The component can be programmed to respond to more than one event.
OBJECT NAMING CONVENTIONS
its Name property to a
When we first create an object, Visual Basic sets
default value. E.g., command buttons are given the names Commandl,
Commnd2, Command3, etc. We must change the names of objects to more
meaningful and descriptive names.
136 t't"t" Computer Systems and Applications - T'Y'B'Com-(Sem' VI)

We use a prefix to describe the class (tpe) of the object followed by a


descriptive natne for tJ:e control. For example, all command buttons have names
that begin with the prefix cmd. The advantages of using a naming convention
are :
1. It makes the code more self explanatory, and
2. Similar objects are grouped alphabetically in the Object list box.
The object naming convention for Visual Basic is as follows :
ObJect Prefix Example
Check box chk chkBold
Combo Box cbo cboSubjects
Command button cmd cmdExit
Form frm frmPayroll
Frame fra fraGender
Image img imglcon
Label lbl lblAge
Line lin linVertical
List box lst lstCities
Menu mnu mnuFile
Option button opt optGender
Picture Box pic picStudent
Shape shp shpCircle
Text box txt txtName
Rules for giving namea to controls :
The names given to controls :
a Must start with an alphabet, and use the first three characters as the
prefix.
o Must contain only letters, numbers, and underscore (_) character.
Punctuation characters, mathematical symbols and spaces are not
allowed in these narnes.
o Must not be more than 40 characters in length.
FORM OBJECT
The graphical user interface consists of several different components put
together as required. But these components have to be placed in some sort of a
container. The object that contains all other GUI components such as text box,
command buttons, etc. is called the form.
When a user interface is being created the creation of the form is the first
step. After the form is created we can place various GUI components on it. The
parts of a form are shown below in Fig 11.1.
Introductton to Visual Basic Controls
t't,'t,' 137

Control Box Minimize


Maximize Close

Caption
tr Calculator
EEE

+* Form

rig' r1'1 : visual Baslc Form


Form properties
The properties of a form are the characteristics exhibited by the form.
Properties can be used to govern both the appearance and behaviour of an object.
Some of the commonly used properties of a form are :
Namlng Conventlon : Form names must start with the prefix frm e.g.,
frmGreeting
Propcrty Descriptioa
Caption or Title It is the text displayed by a window in the title bar. This text is
used to indicate the name of the application or program.
MaxButton This propert5r can be set to True or False. If set to False, the
Maximize button is not displayed.
MinButton This property can be set to True or False. If set to False, the
Minimize button is not displayed.
Name This property is used to give a name to a form.
Top and Left These properties determine the position or location of th'e form on
the window.
Width and Height These properties decide the size of the form.
Form Methods
Methods are used to manipulate the form through program code
Method Descrlption
Open Used to open a form
Move Used to move a form to a new position
Print Used to print a form
Form Events
Associated with a form are several events. The programmer can write code
that will be executed when any of these events takes place.
Event Descriptioa
Click Occurs when a user clicks the form with the mouse button
Load Occurs when the form is loaded
Resize Occurs when a user resizes a window
Unload Occurs when the form is unloaded
13g 1p"t'1, - T.Y.B.Com.-(Sem. VI)
computer systems and Applications

The following figure (Fig. 11.2) illustrates the various controls that can be
used in a Visual Basic project :
Text Box

F Calculator Ix
0.
Option
Button Oocc Oo.* Osir Oo"g* OF.ddrc

CE c

Sla MC 7 I s

Check Box MH 4 5 6 0r Xor

MS 1 2 3 Lsh Nd

M+ 0 + lnt

D E F

rE. 11.2
THE COMMAND BUTTON
The command button is used to initiate an action. E.g., if the user clicks on a
command button, it may trigger an event that prints the contents of the screen,
or closes a program.
Namlng Conventlon : Command button names must start with the prefix
cmd e.g., cmdPrint
Command Button Propetties :
Property Dercrlptlon
BackColor Sets the colour of the Command Button's background. Style
property must be set to 1 - Graphical.
Cancel If this property is set to True, pressing the Escape key at runtime
will activate the Command Button's Click event. Only one
Command Button on the Form can have this property set to True.
Caption It is the text displayed on the command button
Default If this property is set to True, pressing the Enter key at runtime
will activate the Command Button's Click event. Only one
Command Button on the Form can have this property set to Trre.
The command button which has this property set to True will
appear with a darker border.
Name This property is used to give a name to a command button.
Tablndex Sets the order in which the controls will get focus when the tab
key is pressed. The control that has O as its Tablndex will have
focus when the Form is loaded.
ToolTipText When this property is set, the text will popup over the Command
Button when the user hovers the mouse pointer over it. This can
be useful if you cannot fit all the text you need to in the Caption or
to give helpful messages. to the user.
Introduction ta lfistal Basb Confrpls t"t?' 139
Command Button Mcthodr :

Method Dercrlptloa
Move This method changes the position of the command button during
program execution.
SetFocus Sets the focus to the command button. This means ttrat pressing
the Enter key will activate the Click event, even' if another
command button has it's Default propert5r set to True.
Command Buttoa Eventc:
Eveat Dcrcrlptloa
Click It occurs when the user clicks on the command button.
GotFocus Occurs when the command button gets focus either from the Tab
key, when it is clicked on by the user or by using the SetFocus
method.
LostFocus It occurs when the command button loses focus.

TEXT BOX
The text box is used to accept information from the user. It is also sometimes
called tJ:e input box.
ISamlag Coavcqtlon : text box names must start with the prefix brt.
E.g. trrtAuthor.
Tcrt Bor Propcttlcr :
Propctt5r Dcrcrlptlon
Alignment Used to change the alignment of text within the text box. The
values can only be set at design time and not at run time. These
values are :
0 - L€ft Justiff
I - Right Justiff
2 - Center
Enabled Value must be True or False. [f set to False, user cannot enter
data into this text box, but data can be displayed through a
program
Maxlength Determines the maximum number of characters that can be
entered in the text box. By default there is no limit on the number
of characters that can be entered in a text box.
Multiline Determines whether the text box can accept multiple lines of text.
Value can be true or false. By default, a text box accepts only a
single line of text.
Name This property is used to grve a narne to the text box.
Text This property is used to read or set the text in the text box.
(Default Property)

\
140 Computer Sgstems and Applications - T.Y.B.Com'-(Sem' VI)

Tert Bot tethods :


Method Description
SetFocus Transfers control to the text box.
Text Bor Events :

Event Descrlption
Change Occurs every time the contents of the text box are changed
Click Occurs when the user clicks inside the text box.
GotFocus Occurs when the text box receives focus.
l,ostFocus Occurs when the text box loses focus
KeyDown Occurs when a key is pressed while the focus is in a text box.
KeyUp Occurs when a key is released while the focus is in a text box.

THE LABEL
The label object is used to place text on the form. It can be used to identiff
controls that do not have a caption. E.g., label can be placed next to a text box
to indicate the data that must be entered " by the user. The label cannot be
changed directly by the user at run time. lts contents can be changed through
the program or at design time.
Naming Convention : Label names must start with the prefix lbl. E.g.
lblAuthor.
Label Propertles :
Property Descriptlon
Caption This property holds the text to be displayed on the label. This can
(Default Property) be changed at design time or when a program runs.
FontBold Used to display text in bold font
Fontltalic Used to display text in bold font
Name This property is used to give a name to the label.
WordWrap If set to True, the text in the caption will display in multiple lines
Label Methods :

Method Descriptlon
Move Used to move the label at run time.
Label Events :

Events Descrlptloa
Click Occurs when the user clicks with a mouse on the label.
Change Occurs when the text of the label is changed by the application
Double Click Occurs when the user double clicks with a mouse on the label.

THE CHECK BOX


This control is used when a user can select or deselect multiple options from
among those specified. In any group of check boxes, any number of check boxes
can be selected.
Introduc,tionto Visual Basic Contrcls i ttt"ll, 141

If a check box is selected, its Value property becoryres 1; if it is desdlected, its


Value property becomes 0. If a check box is disabled (grayed), its Value property
is 2. when a check box is selected the symbol y' is shown in the check box.
Naming Convention : Check box names must start with the prefix chk.
E.g., chkFont.
Check Box Properties :
Propetty Descrlption
Caption The text that appears next to the check box.
Value This property specifies whether the check box is selected.
(Default Property)
Check Box Events :

Event Descrlption
Click Occurs when the user clicks on the check box.

OPTION BUTTON
This control is called a radio button. It is used when the user can select only
one out of many options.
All related option buttons must be placed inside a frame and not on the form.
A group of option buttons placed inside a frame function together. To place
option buttons inside a frame, we first place the frame object on the form. Then
we click on the option button tool in the toolbox, and draw the option button
inside the frame. We should not double click the option button tool in the tool
box as it will only place the option button on the form and then even dragging it
into the frame will not make it a member of the group.
Naming Coavention ; Option button names must start with the prefix opt.
E.g., optRed.
Option Button Property :
Property Descrlption
Caption It is the text that appears next to the option button.
Value This property specifies whether the option button is selected
(Default Property)
Option Button Events :

Events Descrlption
Click This occurs when the user clicks inside an option button.
Thus, the difference between a check box and an option button is that in a
group of check boxes, any number of check boxes can be selected, but in a group
of option buttons, only one option button can be selected.
IMAGE CONTROL
This control holds a picture. We must set the Picture's property to an image
file with extension .JPG, .BMP, .GIF, .CUR, or .WMF
We first place the image control on the form, and then select its Picture
property in the Properties window.
Naming Conventlon : Image control names must start with tl' e prefix img.
E.g., imgPhoto.

\
142 t"t't' Computer Sgstems and Applications - T.Y.B.Com.-(Sem. V0

Image Properties :

Property Description
Picture It specifies the frle name of the picture that is to be displayed-
(Default Property)
Stretch This propert5r specifies whether a picture is to be resized to Iit the
size of the image control
Image Events :

Event Descrlptlon
Click This occurs when the user clicks inside an image control.

THE SHAPE CONTROL


This control is used to place different geometrical shapes such as circle,
square, rectangle, ovals, on a form. Such shapes can be used to create a
company logo or simply to enhance the visual appeal of a form.
Namiag Conventlon : All shape controls must start with the prefix shp.
E.g., shpCircle.
Shape Propettles :
Propetty Descrlption
Shape O - Rectangle
(Default Property) 1 - Square
2 - Oval
3 - Circle
4 - Rounded Rectangle
5 - Rounded Square
BorderWidth It sets the width of the border
BorderColor It sets the color ofthe border.
FillColor In case of closed shapes such as circle, rectangle, etc, it decides
the color used to lill the inside of the shape. But the FillStyle
property should not be set to Transparent

THE LINE CONTROL


This control is used to draw a line on the form. A line can be used to separate
distinct parts on the form such as the part where inputs are accepted, the part
where output results appear, etc.
To dranrr a line on the form, we click on the line tool in the ToolBox and draw
the line on the form.
Namlng Conveatlon : All line controls must start with the prefix lin.
E.g., linlnputs.
Line Propetties:
Propefty Descrlption
BorderColor This property is used to set the color in which a line is drawn.
BorderWidth This property sets the width of the line. It is a numeric value.
Introduction to Visual Basic Controls t'r?" 143

WORNING WITH MULTIPLE COIVTROLS AND THEIR PROPERTIES


When we have to make changes to many controls at the same time, we can
select more than control and perform various operations on them such as move
the, align, and set similar properties.
How to Select Mutttple Controls?
There are two ways in which we can select multiple controls :
Method 1 : Keeping the SHIFT key pressed, click on each control that is to
be selected. At any time to deselect a control, click on it again.
Method 2 z If the controls are near to each other, use the mouse to drag a
selection box around the Controls. Point to one corner of a box surrounding the
controls, press the mouse button and drag the mouse in one corner. When the
mouse button is released each control has selection handles around it.
Method 3 : To select all the controls on a form, press CTRL + A. Now, to
deselect any control, simply click on that control. Other controls remain selected.
IIow to Deselect Controls?
To deselect controls, just click anywhere on the form.
Setting Propetties for Multlple Controls?
If some controls on a form have common properties, these properties can be
set for all the controls at a time. Select the controls and click in the Properties
window. Common properties are displayed here. E.g., to change the BorderColor
for all objects to blue.
DESIGT{IilG THE USER II{TERAFCE
A user interface allows the user to interact \rith a computer program.
Applications designed using Visual Basic environment must have the look and
feel of standard Windows-based applications. The following points must be kept
in mind while designing a user interface.
1. The user interface should be clear and consistent.
2. Use keyboard access keys.
3. Set a default command button.
4. Use ToolTips to explain the purpose of objects.
5. The design of the screen should be easy to understand and comfortable
for the user.
6. Use standard colors (such as gray) for forms, command buttons.
7. Use white background for text boxes to indicate to the user where data is
to be input.
8. Use gray background for labels whose content the user cannot change.
9. Use standard object size and placement of control.
10.Labe1s that will display a message or result of a calculation should have a
border around them. But labels provide a caption on the screen should
not have any border.
1l.Design your applications to match other windows applications.
12.Create frames to hold related items.
13.Use sans serif font on the forms such as MS Sans Serif; font should not
be made bold.
144 t'r't'' Computer Sysfems and Applications - T.Y.B.Com.-(Sem' VI)

DEFINING KEYBOARD ACCESS KEYS


Access key for a command is the keyboard key that the user can press to
execute the command. People prefer to use the keyboard rather than a mouse, for
most operations. To add an access key in the Caption, to, say, a command
button, we arl ampersand (&) in front of the character we want for the access key.
Visual Basic will underline the access key character. E.g., if the caption for a
command button is &Close, the Visual Basic will display the caption on the
button as Close; the access key character now becomes C and the user activate
this button by either clicking it with mouse or by pressing the ALT + C keys.
Examples:
Type &Ok to get caption as OK with access key as O.
Tlpe E&xit to get caption as Exit with access key as X.
Precautions to be taken in delining Access Keys :
We must take the following precautions while defining access keys :
1. Try to use the Windows-standard keys wherever possible. E.g., for Exit, use
access key as X and for close use C.
2. Two controls should not have the same access key.
Default Propetty of a Command Button :
1. On each form, we can select a command button to be the default command
button that is, whenevei the user presses the ENTER key the command
- clicked
button is even if some other control on the form has the focus.
2. To speciff a command button as default set the Default property to True.
3. Only one command button can have Default property set to True.
Cancel Property of a Command Button :
1. On each form, we can select a default cancel button. - that is, whenever the
user presses the ESC key this command button is clicked even if some other
control on the form has the focus.
2. The Cancel property of the button must be set to True.
3. On a form, only one command button can have the Cancel property set to
True.
SETTING THE TAB ORDER
The tab order is the order in which a user moves from one control to another
by pressing the TAB key. Each form has its own tab order. Usually, the tab order
is the same as the order in which you created the controls.
For example, assume you create two text boxes, Textl and Text2, and then a
command button, Commandl. When the application starts, Textl has the focus.
Pressing TAB moves the focus between controls in the order they were created, as
shown in Figure 11.3.

Pressing TAB moves


the focus to Texl2

Pressing TAB again moves


the focus to Commandl
j,,qqry@1

Ftg. 11.3
Introducrtionto Vtsual Basic Controls Ce'f 145

The TabStop property determines whether focus stops on a control. This


property can be set to True or False. If we do not want the focus to stop on a
control when the user presses the TAB key, we should set its TabStop property to
False.
We can change the sequence in which the controls receive focus; this can be
done by changing the Tablndex property. E.9., in Fig 3 above, if we want the
order of focus to be in the sequence Textl -> Commandl -> Text2, then we must
set the Tablndex properties of these three objects as follows :
Textl Tablndex 0
Commandl Tablndex: 1
Te><t2 Tablndex: 2
CODING FOR CONTROLS
Properties of controls can be set either at design time or at run time. We now
see how to set properties of various objects through programs (i.e at run time).
Clearing Text Boxes and labels
To clear the content of a text box, we set its Text property to the empty (or
null) string "". This must be typed as a pair of double quotes, with no space in
between.
Example 1:
To clear the contents of a text box txtAuthor : txtAuthor.Text = ""
Similarly, to clear the text displayed on a label, we set its Caption property to
the null string.
Example 2 :
lblResult.Caption = ""
Resetting the Focus
To set the focus to a text box, we use the SetFocus method.
Example 3 :
To set the focus to a text box
txtAuthor.SetFocus
Example 4:
To set the focus to a command button
cmdOK.SetFocus
Erample 5:
Write Visual Basic statements to clear the text box called txtCompany and
reset the insertion point into the box.
Solution :
txtCompany.Text = ""
txtCompany.SetFocus
Since Text property is the default property of the text box object we can also
write txtComapny: ""
Example 6 :
Write the Visual Basic statements to clear the label lblCustomer and place
the insertion point into a text box called txtOrder.
Solution :

lblCustomer.CaPtion = ""
txtOrder.SetFocus
146 aPr.jP Comptter Systerzs andAppliutions-T,Y.B.Cont--(Sem. VI)

Settlng the Value Propetty of Optlon Buttoa


The Value property of an option button has only two values - True and Fdse.
1. To make an option button appear selected initially, we set its Value property
to Trre.
Example : optBold.Value = True
2. To make an option button appear deselected, we set its Value property to
False.
Example: optltalics.Value = False
Settlng the Value'Propert5r of Chccl Boncr
For a check box, the Vdue property can have three values :
0 - Unchecked,
1 - Checked, and
2 - Grayed (disabted)
1. To make a box checked :
chkltalic.Value= 1 or chkltalic.Value=Checked
2. To make a box unchecked :
chkBold.Value=0 or chkBold.Value=UnChecked
Example 7
What will be the effect of each of these Visual Basic statemensts?
a) chkPrint.Value = 1
b) lblTown.Caption = txtTown.Text
c) optBold.Value = False
Solutlon:
a) The check box chkPrint will be checked
b) The caption of the label lblTown will become the same as the text entered
in the text box brtTown
c) The option button optBold will be deselected since its Value property is
being set to False.
Changlng the Color of Tert
Visual Basic provides a set of constants called intrinsic constants. Some of
these constants are used to change the color of the text, and these constants are
called color constants. These color constants are the names of the colors with
the prefix vb. These eight constants are :
vbBlack, vbRed, vbGreen, vbYellow, vbBlue, vbMagenta, vbCyan, and vbWhite.
We can use these constants to change the color of text by using tJ:e
FontColor property of text.
Example:
txtStatus.ForeColor = vbBlue
lblBalance.ForeColor = vbRed
Changlng Multlple Propcttlcs of a Control :
Often we have to change many properties of a control one after the other. For
example, consider the following code :
txtAuthor. ForeColor = vbBlue
txtAuthor.Font.Bold = True
Introductbn to Wual Basic Control.s
t"r'r' 147
txtAuthor.Font.Bold = Italic
txtAuthor.SetFocus
Visual Basic provides the With and End With statements which make this
easier :
With txtAuthor
o ForeColor = vbBlue
o Font.Bold = True
O Font.Bold = Italic
o SetFocus
End With
The block of statements beginning with the With clause and ending in End
With clause is called the With block This method is faster than setting each
propert5r individually.
Concatenating Text
The word "concatenate" means 'Join". The ampersand operator (&) is used in
Visual Basic to join or concatenate two or strings.
E.g.
LetlblWord.Caption = "New"
txtWord.Text = " Delhi"
lblWord. Caption = lblWord. Caption & txtWord.Text
Now, lblWord.Caption will become "New Delhi"
.l

OBJECTIVE
I. State whether the following ere true or fdse :
1. Visual Basic projects can have more than one form.
2. Visual Basic provides ready-to-use interface components.
3. All controls have a Caption property.
4. The text box control is used only to display text.
5. There can be only one component of each type in a form. For example, only one
command button in a form.
6. On a form, more than one command button can have its Default property set to
True.
7. On a form, only one command button can have its Cancel property set to True.
8. Events can be triggered only by the user.
9. Properties decide the behaviour of a component.
10. Events and methods are the same thing.
I l. An object name can start with the underscore (-) character.
12. An object name can start with a digit.
13. Object narnes can be of maximum 4O characters.
14. Space character is not permitted in object names.
15. All properties of a component can be set at run time.
16. Once you have initially placed a command button on a form, you cannot reposition it
in any way even during Design time.
17. A check box can have three values of the Value property.
18. An option button can have more than two values of the Value property.

I l/T.Y.B.Com - Com. Sys. & Appl. (Sem. - VI)

t
148 t'3l't' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

19. The TAB key will stop at a control only if the control's TabStop property is set to
True.
20. SetFocus is considered to be an event.
U. Multiple Choice Questions
Select the most appropriate dternative from amongst those glven and rewrlte
the sentence :
1. Advantages of Visual Basic are :
a) Event driven programming concept
b) Rapid Application Development
c) Create applications with GUI
d) A1l ofthe above.
2. An action that an object is capable of performing is called as :
a) Event b) Property
c) Method d) None of the above
3. contains the controls which one can use in the creation of a form.
a) Menu b) Tool Bar
c) Tool Box d) Project Window
4. Which of the following is a valid object narne for a text box?
a) txtClass b) txt Class
c) txt+Class d) All of the above
5. Which of the following statement is incorrect in naming a variable in Visual Basic?
a) Must begin with an Alphabet
b) Must not exceed 255 characters
d) Must have an embedded period or a special Character
e) Must be unique within the same scope.
6. IDE is _:
a) A development environment for machine language
b) Integrated Development Environment for Visual Basic
c) A software project management tool.
d) Independent Debugging and Encoding tool.
7. Which of the following is a part of the Visual Basic IDE?
a) Code window b) Properties window
c) Project Explorer d) All of the above
8. The application name always appears in the _ window:
a) Project explorer b) Intermediate window
c) Title bar d) properties window
9. The color of a cbmmand button
a) Is not changeable
b) Defined in the project
c) Can be changed at runtime
d) Can be changed in the Intermediate window
10. In the IDE, which of following is used to design the layout of an application?
a) Form Designer window b) Froject Explorer wind.ow
c) Context Menu d) Form Layout wind.ow
1 1. The location of the form on the desktop during execution is determined by the:

a) Form Designer window b) project Explorer window


c) Context Menu d) Form Layout window
12. Visual Basic projects are identified by a :
a) ".VBP" suffix b) ".MAK" suflix
c) ".FRM" suffix d) All the above
13. To run an application in Visual Basic:
a) Click on the start button (blue arrow)
b) Use the File Menu

!
Introduction to Visual Basic Controls t,r't, 14g
c)
Use the Project Menu to select Run
d)
None ofthe above
14. The reference library of Visual Basic books is called:
a) MSDN Library b) Help Library
c) Contents d) Topic pane
15. Tool bar:
a) Is part ofthe tool box
b) [rpically appears at the bottom of the screen
c) Contains relevant icons
d) Is part of the Menu
16. Double clicking on the command button icon in the tool box will :

a) Do nothing b) Highlight it
c)
Move it to the form d) Place it on the form
17. The first step in building a project is :

a) Defining the problem b) Writing the code


c) Designing d) Any of the above
18. Each program developed in Visual Basic is called a :
a) Program b) Form
c) Macro d) Project
19. A control named "cmdExit" is most likely a :
a) Command button b) Label
c) Form d) Image
20. Which window display a list of all forms and modules making up your application
a) Projectwindows b) Properties windows
c) Form layout window d) All of the above
21. Properties can be viewed in two ways
a)
Alphabetic and numeric b) Numeric and alphanumeric
c)
Alphabetic and categorized d) None of these
22. W}rich of the following windows is the central to the development of visual basic
Applications :
a) Project window b) Form window
c) Properties window d) All of the above
23. The elements of user interface are :
a) Project and module b) Forms and controls
c) Toolbox and toolbar d) A11 of these
24. Visual Basic controls are :
a) code b) part of the menus
c) rules d) objects
25. There are two types of container controls in VB, namely and
a) Image and Shape b) List box and Combo box
c) Picture box and frame d) Text box and command button
-
ANSWERS
I. [True : 1,2, 6,7,9, L3, 14, L7, 19
False z 3,4,5, 8, 10, 11,12,15, 16, 18, 201
III. [(1-d), {2-a), (3-c), (4-al, (5-b), (6-b), (7-d), (8-c), (9-c), (10-a), (11-d),
(t2-al, (13=a), (14-a), (15-d), (16-d), (17-a), (18-d), (19-a), (2O-al,(2r-c),
(22 -b), (23 - b), (24 - d), (25 - c)l

1. State the names of five GUI components of Visual Basic.


2. What is a method? Give one example.
3. What is an event? Give one example.
150 t'rn!" Computer Sgstems and Applicatiorrc - T.Y.B.Com-(*m. VI)

4. State the purpose of the following components in Visual Basic: Form, Text box,
Command button, label, check box and option button.
5. What are the object naming conventions in Visual Basic?
6. State the naming convention for the following components in a Visual Basic project :
form, shape control, image, line, text box, command button.
7. State and describe at least one propert5r of each of the following controls: form, text
box, command button, label, line, shape control, option button, and check box.
8. State and describe one method of each of the following controls: form, text box,
command button, label.
9. State and describe one event associated with each of the following controls: form,
text box, command button, label.
10. What is the difference between a text box and a label?
11. What is the purpose of the check box control? Explain with an example.
12. What is the purpose of the option button? Explain with an example.
13. What is shape control used for? State any two properties of the shape control.
1.4. What is the image control used for? What is its dbfault property?
15. How does the behaviour of option buttons differ from those of check boxes? OR What
is the difference between option button and check box.
16. State the default property of the following controls: text box, label, shape, check box,
and option button.
17. What are keyboard access keys? What is the purpose of access keys? How can you
deline them in your project?
18. What precautions must be taken by the programmer while defining access keys?
19. Explain the Default property of a command button.
20. Explain the Cancel property of a command button.
21. Explain TabStop and Tablndex properties of a control with the help of an example.
22. What is the focus? How can you change which object has the focus?
23. How are the With and the End With statements used? Explain witJ: an example.
24. What is a ToolTip? How is it created?
25. What is concatenation? Give one example.
26. What are the principles of designing a good user interface?

r??"
Aduanced Features of Visual Basic l,'l,'t' 151

Adoanced Feotures of
Yisual Basic

COMMON DIALOG CONTROL


A common dialog control provides a standard set of dialog boxes for
performing the following operations :
i) Opening and saving files
ii) Selecting fonts
iii) Selecting colors
iv) Setting print options
v) Display Help by running the Windows Help engine.
We can use the common dialog control in an application by adding it to a
form and setting its properties. The dialog displayed by the control depends on
the method used with this control.
Thus, a Common dialog box control is used to allow the user to make some
standard selections in situations such as selecting colors and fonts, selecting
options while printing and saving files.
Adding Commoa Dlalog Control to the Tool Box
The common dialog box may not appear in the Tool Box. We must first add
this control to our Tool Box as follows (Fig. 12.1) :
i) Select Project ) Components.
ii) Locate and select the Microsoft Common Dialog Control 6.0 in the
Controls tabbed dialog. Click on the check box so that a check mark
appears next to this item.
iii) Click on the OK button.
(-onrpone nls E

I.t) TY?E I.JERARY

center UI 1,0 lypc Library


1,0 Trpe Uhdy
fttirex cdrtrdtrEdle
Artivex Pfugin
ADo Data cortrol 6.0 (OIEDB)
Aont ctrfd 2,0
calendar Cortrol 8.0

nkr6oft 6,0 Y
)
Common
Dialog Control

CsEd

fig. 12.1 : Placiag the Commoa Dialog Control in Tool Bor


152 tt't'ro Computer Sgstems andApplications -T.Y.B.Com.-(Sem. VI)

P.laclng a commoa dtalog control on a form


A common dialog control can be placed anywhere on the form. Its location
does not matter because it is invisible when the program runs. Only one common
diatog control is needed on a form - it can disptay all the standard dialog boxes.
When you draw a CommonDialog control on a form, it automatically resizes itself.
We cannot change the size of the control. Windows operating system determines
the size of this control based on the screen resolution.
Once the CommonDialog tool appears in the Tool Box, we can place it on the
form as follows :
0 On the Tool Box, click the CommonDialog control and draw it on a form.
ii) CommonDialog control has a name starting with "dlg".
This control is invisible at run time.
How to uae a CommonDlalog Box?
Once the CommonDialog control has been placed on the form, it can be used
to display various dialog boxes. This is done by using the Show method as
follows :

Method Didog Dlsplayed


ShowOpen Open
ShowSave Save As
ShowColor Color
ShowFont Font
ShowPrinter Printer
ShowHelp Help
Each dialog box has a number of properties that control its behaviour.
File Open and Save As Dialog Box
The Open dialog box allows the user to speciff a drive, directory (folder), a file
name extension and a file name.
The SaveAs dialog box is identical to the Open dialog box in appearance,
except for the following changes :
a) that the dialog's caption is different, and
b) the file names appear dimmed out.
At run time, when the user chooses a file and closes the dialog box, the
FileName property is used.
Example : On a form, place a common dialog control. In the Properties
window, change its name to dlgCommon. We will use this common dialog control
to select a file and display its name and path on the form.
We can now use this dialog to display the File open dialog box as follows :
i) Create a command button and set its caption as Open.
ii) Name the command button as cmdOpen.
iii) In the Click event of this button, type the following code :
Private Sub cmdOpen_Clickfl
'Display the File Open box
dlgCommon.ShowOpen
Forml.Show
Print dlgCommon. FileName
End Sub
Aduanced Features of Visual Basic lr,t'tt, I53
1. Run the program. Click the button and you will see the following dialog box
is displayed :

Open
iTllEl
{- e}

&
My Berent
Documer*s
Documents
my Computer
Network Places
Adobe Reader I
Toolbox.l.9
Free Movies & Games
?
iTunes
Nero Startsmart
Nok6 Music
QukkTime Phyer
RealPlayer 5P
samrung PC studio 3

File name:

Ftes of type:

r
DlS. 12.2: Flle Opea Dlalog Bor
2. Select a file form the list shown in this box and click on OK. The filename is
displayed on the form.
Color Dialog Box :
The Color dialog box allows the user to select a color from a palette or to
create and select a custom color. At run time, when the user chooses a color and
closes the dialog box, the Color property is used to get the selected color.
Erample 1:
On a form, place a common dialog control. In the Properties window, change
its name to dlgCommon.
We can now use this dialog to display the Color dialog l FItx (-alo

box as follows :
0 Create a command button and set its caption as ITTT TT r
Color.
ii) Name the command button as cmdColor.
iii) In the Click event of this button, type the following
code :
Private Sub cmdColor-Click$
'Display the Color box
dlgCommon.ShowColor
Cmd OK
End Sub
Run, the program. On clicking the command button,
the following color selection window appears (Fig. 12.3) : -.----- -
"T.;l1i;i1':l
Font Dialog Box :
The Font dialog box allows the user to select a font by its size, color, and
style. Once the selection has been made in the Font dialog box, we can use the
properties of the Font dialog box, to set the font.
154 tt't?' Computer Systems andApplications-T'Y'B'Com-(Sem' W

Bold
Bold ltalic

FlS. 12.4: Font Common Dldog Bon


Print Dialog Box :

Status: i*e**ai&
lrne: l.FLa$.d.. Su*rarll

ryr
I LEKI:
rr::rri
8K'1

Ftg 12.5 : Priat CommonDlalog Box


The Print dialog box allows the user to speciry how the output should be
printed. The user can speciff a range of pages to be printed, the print guality,
number of copies, etc. This dialog box also shows information about the currently
installed printers and allows the user to change the printer settings and select a
printer.
Example : On a form, place a common dialog control. In the Properties
window, change its name to dlgCommon.
We can now use this dialog to display the Printer dialog box as follows :
i) Create a command button and set its caption as Printer.
i0 Name the command button as cmdPrinter.
iii) In the Click event of this button, type the following code :
Private Sub cmdPrinter_Click()
'Display the Printer box
dlgCommon. ShowPrinter
End Sub
Run, the program. On clicking the command button, the following printer
selection window appears (Fig. 12.6) :
Aduaned Feafr,res of Vrs,rurrlfusic ,n,. r55
$ r,,,,,r )x

ts
AddRtlt.r
&&
hgtBr* iM,Os
l0t0sr... oGrslt...
Prffi

R.o*" '
l-cCirr
Co.rwt

lla. 14.6: lrbtDlrbtlc


Hclp Dtalog Bor :
This dialog box is used to which help file
to display in the
GEITERAL PROCEDT'RT8
A procedure is a separate section of code which performs one or more specific
tasks; a procedure is identilied by a name. Visud Basic has four types of
procedures which can be divided into two broad categories event procedures and
non-event procedures. These procedures are :

I. Event procedure
a Event procedures
a Sub procedures
o Function procedure, and
o Property procedure
Event procedure is the c'ode that is exccuted in response to events such as
mouse click, key press, change in an object's state, dragging the mouse, etc. So
f,ar we have used only' event procedures. Non-event procedures i.e., sub-
procedure, function procedure and property procedure are not event-dependent.
These three procedures are called. from an event prccedure or from another non-
event procedure. We shall shrdy in detail about sub-procedures and function
procedures as the more advanced topic of property procedure is not part of the
syllabus.
Sub-procedures. and frrhctio*proccdunes ane also called general procedures.
ln the figure below (Fig. 12.7) we illustrate how an event procedure may call a
general procedure

\
156 tl?'t' Computer Systems and Applications - T.Y. B.Com.-(Sem. VI)

Click event Procedure A Function C


procedure Code
Call function C Code
1 Code
Code +-----
CallBrucedtiif
Code Procedure B
Code
Call B

5 Code

--+
Key : Calling a procedure / function, Returning to calling program
Flg. L2.7 Illurtratlng how proccdures taay be ltnked
We now explore the working of the procedures with reference to this diagram.
i) When an event procedure is executed in response to an event, the code in
the event procedure starts executing at line 1, as shown in the figure
(Fig. 12.7) above.
i0 At line 2, there is a call to procedure A. So control is transferred to
procedure A, and the code in Procedure A starts executing.
iii) In Procedure A itself, there is a call to a function C. So control is
transferred from Procedure A to Function C. When the code of Function C
is over, control is transferred back to the Procedure A.
iv) When the code in Procedure A is over, control is transferred back to the
calling procedure which is the event procedure. Control is now at line 3 in
the event procedure.
v) At line 4 in the event procedure, there is a call to Procedure B, and so
control is transferred to Procedure B. When the code of Procedure B is
over, control comes back to the event procedure at line 5.
NEED FOR PROCEDURES AND FUNCTIONS
Although all Visual Basic programs will have a few event procedures, it is not
necessarJi to use sub-procedures and event procedures. But programming
becomes easier and more eflicient programs can be written by using sub-
procedures and functions.
Advantages of using procedures and fuactloas :
The advantages of using sub-procedures and functions are as follows :
o Avoid repetltlon of code : If there is identical code in tow or more event
procedures, it can be written just once in a procedure, and that procedure
can be invoked (called) from various places in tJ:e program.
o Improve code readablllty : If an event procedure is very lengthy and has
many lines of code, it is better to break up the code into smaller parts and
store this in many procedures. This improves the code readability.
o Re-ueability of code : If a particular code is required in many different
programs, it makes sense to write a procedure which can be called in any
program. For example, if there is a data validation code such as validating
Aduanced Feafures of Vbual Basic t't'tt' 157
the email address, then we can write a procedure called validate_email$
and use it in other programs.
o Ease of debugging programs : If a program is split up into smaller logical
units, it is easier to debug and detect errors. Code upgradation and
maintenance also becomes easier.
SUB PROCEDURES AND I.UNCTION PROCEDURES
In the above diagram (Fig. 12.7) we have used sub-procedures (Procedure A
and B) and a function procedure. There are two major differences between a sub-
procedure and function procedure :
i) A function procedure performs some action and returns only one data
item to the calling part of the program. This value that the function sends
back to the calling part of the program is called the return value. A sub-
procedure is a procedure that performs some action. It may not return
any value to the calling part of the program.
iil The way in which a function procedure is called is different from the way
in which a sub-procedure is called.
CREATING A NEW SUB.PROCEDURE
There are two ways to create a sub procedure or a function. One method is to
yourself write the entire code and the other method is to use a template to create
part of the code. We will use the second method - using a template.
Erample 1 :
In the following example, we will illustrate the concept of creating a sub-
procedure that changes the color of the form - from default gray to red, when the
user clicks a command button.
Step 1 : Start a new Visual Basic project.
Step 2 : On the form, place a command button.
Change the following properties of this command button :
Name: cmdChngColor.
Caption : Change Color
Step 3 : Double click on the command button to
open the code window. Tlpe the following code idd Procedure trl
in the event procedure for this command button:
Name;
Private Sub cmdChngColor-Click$ I

chgColor Cancel

End Sub
In this event procedure, notice the line
chgColor. This is a call to the sub-procedure
called chgColor.
Step 4 : We now create the sub-procedure called l- lll tocal vaiiables as statics
chgColor. Keep the code window open.
fig. 12.8 : Uslng the Add
Select Tools ) Add Procedure. The following Procedurcdidog bor to add a new
window (Fig. 12.8) appears : , geaerd procedure
Step 5 : In the Add Procedure dialog box, type
the name of the procedure as chgColor.
Step 6 : Select Scope as Private.
Step 7 : Leave the ffie as Sub and click on OK.

\
158 tt't"t' Computer Sgstems and Applications - T.Y.B.Com.-(Sem. VI)

This creates a new sub procedure as shown below :


Private Sub chgColorfl
Forml.BackColor = vbRed
End Sub
We observe that this procedure is similar to the other procedures that we
have created. But this procedure is not associated with any event. This sub-
procedure can be executed if it is called (invoked) from another procedure. We
put the name of this general sub-procedure in the command button's click event
procedure. Thus, when the command button is clicked, the event procedure
cmdChngColor_Clickfl is called which in turn calls the general sub-procedure
whose name is chgColor. So, to call a general sub-procedure we just put its name
in the calling procedure. In this example, chgColor is the called sub-procedure
which is invoked from the event procedure cmdChngColor-Clickfl.
Example 2 :
Let us create a simple application that uses a general sub-procedure to
rt::p' -' 'oday's date on a form.
1. Create a new project in Visual Basic.
2. Or: the form, place a command buttun.
3. In the Properties window, change the following properties of the command
button :
a) Name: cmdShowDate
b) Caption: Show Date
4. Double click on the command button to open the code window. Visual Basic
creates the template for the click event procedure as follows: 'Ilpe the
following code as shown between the lines Private Sub .. and End Sub :
Private Sub cmdShowDate_Click(f
showDate
End Sub
1. Let the code window remain open. In the Tools menu, click on Add
Procedure. The Add Procedure window as shown in Fig above appears.
2. Type the name of the procedure as showDate.
3. Visual Basic creates the template for the sub-procedure. Tlrpe the following
code :
Public Sub showDate(f
MsgBox ("Today is " & Date)
End Sub
1. To run the program, click on the Run button or press F5. You wilI get the
following window (Fig. 12.9) if you click on the command button.
t Fr-rrnr1 I-llqltrl

Prr:ject1 trf

Show Date
o{(

Flg. L2,9 : Ruanlag thc program to dtepley the curroat tyrtem date
Aduanced Features of Wual Basic t"r'lr' 159

PASSING VARIABLES TO PROCEDURES


Most procedures contain variables that are declared inside the procedure
itself. These variables can only be used inside that procedure. But if a variable is
declared inside a module's general section, it becomes a global variable. Such a
variable can be accessed by all procedures within that module. Variables
declared with the keyword Public inside the general section are global variables.
We should avoid global variables as much as possible and use only local
variables. Variables declared inside a procedure with the Dim keyword are called
local variables.
Sometimes it is necessarJr to use variables of one procedure in another
procedure. Variables that are passed from one procedure to another are called
arguments or parameters. Argurhents can be passed to a procedure or a function
either by vdue or by reference.
PASSING ARGUMENTS BY VALUE
When arguments are passed by value, only a copy of the argument is passed
to the sub-procedure or the function. Any changes made to the variable in the
called function or procedure do not affect the value of the variable in the calling
function. This can be seen in the following illustration.
MyProc(x)

Called Procedure
Calling Procedure
X=X+20
Dim XAs Integer

X=10
Print "X is " & X
MyProc X

Print "X is " & X


ofProcedure

Output:
Output:
Xis10 Xis30

In the calling procedure, X has the value 10. We cdl the procedure MyProc
and pass the value X to it. In the called procedure, the value of X is increased by
20 and it becomes 3O inside the procedure MyProc. But when control returns
back to the calling function, X again has the value 1O. Thus, the called function
has changed the value of X but this change is not visible in the calling function.
How is a variable Passed bY Value?
To pass a variable or parameter by value to a procedure, we simply state the
narne oi th. variable afterlhe narne of the called sub-procedure. Thus, to call the
procedure MyProc and pass the value of the variable X to it, we will invoke the
procedure foUo*", tUyeroc X. In the called procedure, we must speciff the data
'type ""
of the passed variable as follows : MyProc (Byval X As Integer). The name of
th" specified in the called function can be different from the name
"rgrr-ent
specifiJd when ihe procedure is invoked. So we can write MyProc (Byval X As
160 t??' - T.Y.B.Com.-(Sem' VI)
Computer Systems and Applications

Integer) as MyProc (Byval Y As Integer), and use the variable Y inside MyProc.
The following example illustrates this concept of passing argument by value:
Example:
Create a new VB project with the following objects and properties as shown
below:
ObJect Property Value i Forrrrl uatr
Button Name cmdCallFn
Caption Call F\rnction
Label1 Name Labell
Caption
Label2 Name Label2
Caption
CrtFrrdim
Labe13 Name Label3
Caption

Code :

Private Sub cmdCallF'._Cltck()


Dim X As Integer
X= 10
Labell.Caption = "X before leaving the procedure ( _
"cmdCallFn_Click$ : " & X

MyProc X

Label3.Caption = "X after entering the procedure f _


"cmdCallFn_Click$ : " & X
End Sub

Hvate Sub MyProc{ByVal X As Integerf


x=x+20
Label2.Caption = "X inside the procedure Myproc : " & X
End Sub
When the user clicks the command button, the ou t window is
displayed : i For lnl
trtrrtr
leaving the procedure cmdCallFn_ Click[]: 10

procedure MyFroc : 30

X after entering the procedure cmdCallFn_Click[] :

Cdl Function

Fig. 12.1O
Aduanced Feafires of Visual Basic t"t,t, 161

A sub-procedure may be called with one or more arguments. But the number
of arguments, their sequence and their data types must match in the calling
location and in the called location.
Example
Consider a call to a function PrintValue as follows :
PrintValue(P, R, T), where P, R and T are all integer data types representing
the principal amount, interest rate and time period respectively.
In the called part of the code we must write :
Private Sub MyProc(P as Integer, R as Integer, T as Integerf
But the following is invalid since only two parameters are specified in the
called part of the procedure.
Private Sub MyProc(P as Integer, R as Integerf
PASSING ARGUMENTS BY REFERENCE
When we pass an argument by reference, we are passing the address of the
argument to the called procedure. This is the default way of passing arguments
to a procedure. Every variable is stored in the primary memory (RAM) and every
location in memory has a fixed address. If the called procedure knows the
address of the variable, it can change the argument's original value. Hus, if we
pass an argument by reference to a called procedure, its value can be modified by
the called procedure. So when control returns to the calling procedure, the
variable may have a new value. This is illustrated in the following diagram:
MyProc (x)

Called Procedure
Calling Procedure

Dim X As Integer
X=X+20

X=10
Print "X is " & X
MyProc X

Print "X is " & X


of Procedure

Output:
Output:

Xis30 Xis30
How is a varlable passed by Refercnee?
To pass a variable or parameter by reference to a procedure, we state the
name of the variable after the narne of the called sub-procedure. Thus, to call the
procedure MyProc and pass the value of the variable X to it, we will invoke the
procedure as follows: MyProc X. In the called procedure, we must speciff the data
type of the passed variable as follows: MyProc ( ByRef X As Integer). The name of
the argument specilied in the called function can be different from the name
specified when the procedure is invoked. So we can write MyProc (ByRef X As
162 f;f;t @n'ptW Sys&,nrs andAppliations-T.Y.B.Com.-(Sem. V0

Integer) as MyProc (ByRef Y As Integer), and use the variable Y inside MyProc.
The following example illustrates this concept of passing argument by value :
Exenple:
Create e new VB project with the following objects and properties as shown
below:
ObJcct Propcrty Vduo r l,,trrt1 X
Button Name cmdCdlFn
Caption Call Arnction
Label1 Name Labell
!u
Caption
I,abel2 Name Label2
gD
Caption
Label3 Name Label3
4'
Caption
Codc:
Hvate Sub
Dim X As Integer
X= 1O
Labell.Caption = "X before leaving the procedure s -
"cmdCallFn-Click() : " & X
MyProc X
Label3.Caption - "X after entcriqg Ore procedure " _
"cmdCallFn-Click$ : " & X
End Sub
Hvate Sub fyProclByRof tr Ar htiralrl
X=X+20
Label2.Caption = "X inside tlle proeedure MyProc : " & X
End Sub
r l,'rrrrl - f-fx
When the user clicks the command
button, the window shown below in
Fig 12.11 is displayed. Note that the value
of the variable X is 10 originally but is
changed by the procedure MyProc. When we
display the value from the original
procedure, after returning from MyProc, the
value displayed is 3O. Thus, changes made
by the procedure MyProc are now
permanent.
tl3. 12.11 : Eficct of plrrla3
erguncatr b5r rclcrclcc
Aduanced Features of Visual Basic t'r't' 163

FUNCTION PROCEDURES
A function procedure is a procedure that performs some action and also
returns a value to the calling part of the program. The value that a function
procedure returns is called its return value. We must differentiate between a
sub-procedure and a function procedure: a sub procedure only performs a set of
actions, but a function procedure also returns a value. A function procedure is
also called a function.
Visual Basic has two types of functions :
o Bullt-in functions : these are predelined in the Visual Basic language
and can be directly used without worrying about their internal code.
o User-deflned functlons : these are functions written by the programmer.
IIow to Write hraction Procedure or a Functioa?
A function is written in the same way as a sub-procedure. The word Function
is used in place of the word Sub when defining a function
To create a new function procedure :
Step I : Start a new project of type Standard EXE.
Step 2 : Place the objects and set their properties as shown in the table below :
ObJect Property Vdue ObJect Propetty Value
Button Name cmdCalc Label 3 Caption Number 3
Caption Calculate Label4 Name lbLAvg

Label I Name lblNuml Caption Average

Caption Number 1 Text Box 1 Name txtNuml


I,abel2 Name lblNum2 Text Box 2 Name txtNum2
Caption Nuinber 2 Text Box 3 Name txtNum3
Label 3 Name lblNum3 Text Box 4 Name txtAvg

t Forrnl tr x
lblNuml brtNumL

lblNum2 fttNum2

lblNum3 brtNum3

lblAvg brtAvg

cmdCal

F.tg. t2.t2

l2lT.Y.B.Com - Com. Sys. & Appl. (Sem. - VI)


164 tl't"t* Computer Systems and Applications - T.Y.B.Com.-(Sem- VI)

Step 3 : Type the following code in the code window :

Hvate Sub cmdCalc-Click{f


Dim A, B, C As Integer

A = Val(txtNuml.Text)
B = Val(txtNum2.Text)
C = Val(txtNum3.Text)

txtAvg.Text = Average (A, B, C) 'this is a function cdl


End Sub
te Functlon Avergge (ByVal A As Integer, ByVal B As - Integer, ByVal C
Integerf As Double
Average=(A+B+C) /3
End Functlon
We have written our own function to calculate the average of three integers
passed to it. Observe the following points in this code :
i) The function is called inside the event procedure, cmdCalc-Click. The
function call is txtAverage.Text = Average (A, B, C). The three parameters
whose average is to be calculated are passed to the function called
Average.
iil Since a function returns a value, we assigtr this returned value to the text
box named txtAvg.
iii) The function definition header is the line:
Private Function Average (ByVal A As Integer, ByVal B As - Integer,
ByVal C As Integerf As Double
Thus, a function is defined by using the keyword Function :
0 In the function definition, we declare the arguments that the function
needs. All the arguments are passed by value since we do not want the
Average function to change the values of A, B and C variables. This is the
argument list. The argument list specifies three things: number of
arguments, data type of arguments,.and sequence of arguments. The
sequence of arguments is important; it should be the same as in the
function call.
ii) Since a function returns a value, we must specift the return type of the
function; this is done in the example by writing: As Double. Thus, this
function returns a value of data type Double.
iii) The body of the function does some calculation; in this case finding the
average. But observe that the calculated value is assigned to "Average" -
and this is the same as the natne of the function. Thus, we must set the
function name to some value.
iv) A function is terminated by the statement End Function.
Erample:
Write a function to calculate the amount of simple interest earned on an
investment. The amount invested, the interest rate and the number of years for
which the amouht is invested are to be input by the user.
Step 1 : Open a new project and design the form as shown in Fig. L2.L3 below.
The controls and their properties are shown in the table below :
Aduanced Features ofVisual Basb
l''t?' 165

r Sinrple lnterest tr tr
lblPrn
txtPrn

lblRate
bGRate

lblTime
brtTime

+- shpline
lbllnteres txtlnterest

Cahri$e
cmdCal

Ftg.l2.fg : Coaputing Simple Interest uaiag a Function

Controls and thelr Propetties :


ObJect Property Value
Form Name frmlnterest
Caption Simple Interest
Label 1 Name lblPrn
Caption Principal Amount
Label2 Name lblRate
Caption Interest Rate
Label 3 Name lblTime
Caption No. ofYears
Label 4 Name lbllnterest
Caption Interest Earned
TextBox 1 Name txtPrn
TextBox 2 Name txtRate
TextBox 3 Name txtTime
TextBox4 Name txtlnterest
Enabled False
Command Name cmdCalc
Button
Caption Calculate Interest
Line Name shpLine
166 lr't't' Computer Systems and Applications - T.Y.B. Com.y'Sem' VI)

Step 2 : Type the following code in the code window :


Private Sub cmdCalc-Cltckfl
Dim P As Currency 'principal amount
Dim R As Single 'interest rate
Dim T As Integer 'time for which amount is invested
Dim I As Currency 'interest earned

'collect data from the text boxes


P = Val(txtPrn.Text)
R = Val(txtRate.Text)
T = Val(txtTime.Text)

'now call the function Calclnterest


'and store the return value in I
I = Calclnterest(P, R, T)

txtlnterest.Text = Format(I, "Currency")


End Sub
Private Function Calclnterest(ByVd P As Currency' -
ByVat R As Slngle, _
ByVal T As Integerf As Currency
'this function calculates the simple interest
Calclnterest = P * R * T I IOO
End Functloa
i Sinrple lnterest tr@tr
Step 3 : Run the program, enter test data and click
on the command button. The following window is PilrcpdAmqr*

displayed:
Example : Write Visual Basic code with the lntaest Bde

following functionality: when the user clicks on a


command button on a form, display the message No. o[Years

"Now inside a sub-procedure"; this message


should be displayed in a message box. The
message should be displayed by callipg a lntered Earned -10.011

sub-procedure from the command button's Click


event.
Step 1 : Open a n'ew project and design the form as Lalcu&e
shown in Fig below. The controls and their properties
are shown in the table below :
Fig. 12.14
Controls and their Propettles :
ObJect Property Value
Command Button Name CmdMsg
Caption Show Message
Aduanced Features of Vi-sual Basic lr'l''t' 167
2z the code in the code window :

Private Sub cmdMsg_Click(f


ShowMessage
End Sub

Private Sub ShowMessage(f


MsgBox "Now inside a sub-procedure"
End Sub
Step 3 : Run the program, click on the command button and veriff that the
message box displays the appropriate message.
Example:
Write a Visual Basic program with the following functionality: User enters
two numbers in two different text boxes. On clicking a command button, the
larger of the two numbers should be displayed as the caption of a label on the
form. A function Max should compute the larger of the two numbers.
Step I : Open a new project and design the form as shown in Fig. below. The
controls and their properties are shown in the table below :
Controls and their Propertles :
ObJect Property Value
r Folnrl ttrlltl Label I Name lblNuml
Caption Number 1
I Label2 Name lblNum2
Caption Number 2
Label 3 Name lbllarge
Caption Large No
Label 4 Name lbLAns
Caption
Comamnd Button Name cmdLarge
Caption Find Larger No.
Step 2 : Tlpe the following code in the code window
Private Sub cmdlarge-Cltck(f
Dim A As Integer
Dim B As Integer

'collect data from the text boxes


A = Val(txtNuml.Text)
B = Val(txtNum2.Text)
'now pass these arguments to the function Max
lblAns.Caption = Max(A, B)
End Sub

Prlvate Functloa Max(ByVal X As Integer, ByVal Y As Integerf


IfX>YThen
Max=X
Else
Max=Y
End If
Ead Function
168 t'r't' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

Step 2 : Run the program and veriff the results. i Swap l'{unrbers
Erample: . 0rbindVakres . . SwappedVatres . .

Write a Visual Basic program with


the following functionality: Ask the user to enter
two numbers into text boxes. When the user
clicks the command button, a sub-procedure
Swap should be called and the swapped values of
the two boxes should be displayed in the two
labels. The Click event should then display the
swapped values in the two labels.
Step I : Open a new project and design the form
as shown in adjoining Fig. The controls and their
properties are shown in the table below :
Object Property Value
Label I Name Labell
Caption Original Values
Label2 Name Label2
Caption Swapped values
Label 3 Name IblNuml
Caption
Label 4 Name lblNum2
Caption
TextBoxl Name txtNuml
TextBox2 Name txtNum2
Commald Name cmdSwap
Button
Caption Swap Values
Step 2 : Tlrpe the following code in the code window
Private Sub cmdSwap_Click(f
Dim A As Integer
Dim B As Integer

tollect data from text boxes


A = Val(txtNuml.Text)
B = Val(txtNum2.Text)

Swap A, B 'call the Swap procedure

lblNuml.Caption = A
lblNum2.Caption = B
Ead Srib
Private Sub Swap(ByRef A As Integer, ByRef B As Integer)
Dim Temp As Integer
'exchange values of A and B by using a temporar5r variable
Temp = A
A=B
B = Temp
End Sub
Aduanced Features of Visual Basic f"1t n 169
Step 3 : Run the program and veri$r that the output is correct.
Note : In this program, we are passing arguments by reference since we want
that any changes made by the procedure Swap should be permanent. Swap gets
the address of the two variables A and B and so when the values are exchanged,
they are done in the original location of A and B. These changes can then be
observed as we print these values again in the click event proced.ure.
USER.DEFINED SUB PROCEDURES IN BRIEF
User defined sub procedures
is a collection of 2 or more lines of code that can be invoked from one
or more places in the progr€rm
create when duplicate code will be used several times within the
program
to create a new sub procedure,
o OPEN the CODE window
click TOOLS
click ADD PROCEDURE
o give it a meaningful name; e.g., Factorial
a select Sub
o cnd select Private
code cannot be executed unless specifically CALLED from another
procedure
o it will be CALLED from other EVENT procedures
PROGRAMMING EXERCISES
1. Write a simple Color dialog box application that lets the user display a Color
dialog box simply by clicking a command button. When the user selects a color
and closes the Color dialog box, set the command button's BackColor property to
the user's selected color.
2. Write a function called CalcArea that computes the area of a rectangle.
Arguments received by the function are the length and breadth, both of data type
Integer. Write the appropriate code in the click event of a command button that
will execute the code in the function CalcArea. The area should be displayed by
the Click event procedure. Area of a rectangle = length x breadth
3. Write a function ChangeCurrency that accepts two arguments: one argument
is the amount in Indian Rupees, and the other argument is the exchange rate for
conversion from Indian Rupees to US Dollars. Select arl appropriate data type for
both these arguments. The ChangeCurrency function should convert from Indian
Rupees to US Dollars. The C1ick event of a command button should display the
result in a label.
4. Write a function Factorial that computes the factorial of a number entered by
the user. The input is given by the user in a text box, the factorial calculation
must be done by the Factorial function and the output must be printed in a label,
through the click event of a command button.
5. Write an event procedure in VB to lind the sum and average of "n" numbers
given as input.
6. Write a Visual Basic program to compute the GCD and LCM of two integers
entered by the user. The GCD and LCM should be calculated by a function called
GCDLCM.
17O t|"t"t" - T.Y.B.Com.-(Sem. VI)
Computer Sgstems and Applications

7. Write a project to design a suitable form to allow the conversion of currency


from Indian Rupees to US dollars or Vice-Versa. The project should provide two
option buttons asking the user to select either Indian Rupees to US dollar or US
dollar to Indian Rupees. Allow the user to enter the amount and based on the
selection convert the amount to the desired currency and display the results.

OBJECTIVE

I. State whether the followlng are tnre or false :


1. A common dialog box can be placed at any location in a form.
2. The size of the common dialog box can be decided by the programmer.
3. The Color dialog box limits the user to a few limited color values
4. The common dialog box object starts with the prefix dlg.
5. A sub-procedure can be called only from an event procedure.
6. If a program is split up into smaller logical units, it is more difficult to debug.
7. A procedure can have two or more arguments or parameters.
8. A function procedure can return one or more data values to the calling procedure.
9. Functions help in the reusabilit5r of code.
10. A sub-procedure cannot modify the values of arguments passed to it.
1 1. Variables declared inside a sub-procedure with the Dim keyword are local variables.

12. Passing by value is the sarne as sending a copy of the variable to a sub-procedure.
13. A sub-procedure can be called only with one argument.
14. Global variables can be shared by all procedures of a program.
15. Global variables should be used as much as possible.
U. Multiple Choice Questions
Select the approprlate optioa from the followiag :
1. Of these, is not a valid Show method of common dialog box.
a) ShowHelp b) ShowPrinter
-
c) ShowColor d) ShowDrives
2. procedure is the procedure that is executed in response to events such as
mouse click.
- Property procedure
a) b) Function procedure
c) Event procedure d) Sub procedure
3. Variables can be shared by different procedures ofa program ifthey are _
a) Declared as global variables b) Passed by reference
c) Passed byvalue d) Any ofthe above
4. Common dialog box _
a) is a way by which Visual Basic program can translate the text on the screen into
another language.
b) displays the predefined Windows dialog boxes for print, open, save, fonts, and
colors.
c) can only be used on message boxes that will pop up and prompt the user for text
input.
5. The prefix for naming a menu item is _
a) m b) mnu
c) men d) mne
6. Which of these is an advantage of using procedures and functions?
a) They improve code readability b) They help in code re-usabitity
c) Debugging becomes easier d) All of the above
7. Every procedure is terminated by the statement.
a) End b) End Do
c) End Subforms with menus. d) allows you to create
AduancedFeafires of ViatalBasic fg.19. t7t
8. When it is desired that a menu item does not appear at run time, it must be ensured
ttrat the following property/properties must be set to false
a) Enabled b) Visible
c) Both Enabled and Visible d) Both Checked and Visible
9. What is the final keynord used to indicate the end (compilation) of a sub procedure?
a) End Sub b) Exit Sub
c) End d) None ofthe above
f O. Which of the only event for a menu control is available?
a) Load b)
Resize
c) Click d)
KeyPress
11. When variables are passed by reference (ByRef) to a SUB program,
a) only the memory addresses of the variables are passed.
b) a value of a variable is passed.
c)
a copy of the variable is passed.
d)
none ofthe above
12. When creating a menu, how do you create a menu separation bar:
a) In the Caption text box, enter an ampersand (&)
b) Select Menu Separator check box
c) In tJre Caption text box, enter a hyphen (-)
d) In the Caption text box, enter the text "Separator'

lArrswpRsl
I. [True : l, 4,7,9, I l, 12, 14
False 22,3,5,6,8, 10, 13, 15]
III. [(r-d), (2-d), (3-d), (4-b), (5-b), (6-d), (7 -cl, (8-b), (9-a), (10-c), (11-a),
(12 - c)l

OUESTIOITS
1. E:rplain the difference between a menu and a sub-menu.
2. What is a separator bar and how is it created?
3. E:rplain tl:e naming convention for a menu and its sub-menu.
+. State the steps for adding the common dialog control added to the tool box.
5. What does the term oommon dialog box mean? OR What is the purpose of a Dialog
Box Control in Visual Basic?
6. What is the use of the common dialog box control?
7. How many difrerent dialog boxes can the Common Dialog Box control produce?
8. Explain the Menu Editor window.
9. Differentiate between passing parameter by value and passing parameter by
reference. Illustrate with an example.
lO. What is the disadvantage of declaring a variable as a global variable?

Cft,'
172 g'r'l'' Computer Sgsfems and Applications - T.Y.B.Com.-(Sem. VI)

r3 Yisuol Basic Loo/s

LOOPS IN VISUAL BASIC


The process of repeating a set of statements is called looping. The group of
repeated instructions is called a loop. The loop repeats until some specified
condition at the beginning or end of the loop is met.A single execution of the
statements in the loop is called an iteration.
Visual Basic provides the following looping techniques: Do...Loop and
For...Next loop.
DolLoop :

The general syntax of the Do/Loop is as follows :

Syntax:
Formatl: Format2:
Do (While I Until) condition Do
'statements of the loop 'statements of the loop
Loop Loop (While I Until) condition
Execution of a Do/Loop continues while a condition is true or until a
condition is true. This loop is used when the exact number of iterations is not
known.
The loop condition is evaluated to determine whether or not to execute the
statements within the body of the loop. The condition must evaluate to True or
False and relational operators such &s (, ), <=, etc are used in the condition.
Difference between operation of lPhlle loop and Until loop : In case of the
do/while loop if the condition is True, the statements in the body of the loop are
executed. But in case of do/until statement, the statements are executed if the
condition is False.
If the condition is checked at the beginning, of the loop (as in format 1
above), the loop may not execute at all. This is called pre-test since the condition
is checked at the beginning of the loop. But if the condition is checked at the end
of the loop (as in format 2 above), the loop is executed at least once. This is called
post-test since the condition is checked at the end of the loop.
Examples of Do Loop :
o Do Until/Loop Example :
Counter = 1
Do Until Counter > 10
Print Counter
Counter=Counter+ 1

Loop
This loop repeats Until the Counter variable exceeds 10.
Visual Basic Loops ,"t?' 173
. Do/Loop While Example:
Sum=1
Do
Print Sum
Sum=Sum+3
Loop While Sum <= 25
This loop repeats while the variable Sum is lesd than or equal to 25.
o Do/Loop Until Example :
Sum=1
Do
Print Sum
Sum=Sum+3
Loop Until Sum > 50
This loop repeats Until Sum is greater than 5O.
o Do While/Loop Example:
Counter = 1
Do While Counter <= 1000
Print Counter
Counter=Counter+ 1

Loop
This loop repeats as long as (while) the variable Counter is less than or equal
to 10O0.
For / Next Loop
The For/Next loop is used when a group of statements is to be repeated a
specific number of times. This loop uses a variable called t}re loop index. This loop
index determines the number of times the loop will be executed. The loop is
executed as long as the initial value is less than or equal to the final value.
General Syntax:
For indexuar = initial-ualueTofinal-ualue [Step svalue]
Statements
Next lindexual
Example 1 :
ForI=1To5
Print I
Next I
Comparing this loop with the general syntax :
Indexvar is I, initial value is 1 and final value is 5. In this example, there is
only one statement inside the body of the loop. The step value is not given in this
example, so step value is assumed to be 1. Step value is the value bywhich the
value of I is increased. In this case, I will increase by 1 after each iteration.
When the For statement is reached, the initial value of I is set to 1. This value
is compared to the final value i.e. 5. If initial value is less than or equal to 5, the
statements in the body of the loop are executed and control reaches the
statement Next I. This statement increases the value of I by 1, so I becomes 2.
The new value of I is again compared with the final value (5). As long as the initial

,l
174 3l"t"jl' Computer Systems andApplications -T.Y.B.Com.-(Sem. VI)

value <= final value, the statements inside the loop are executed. So in this case,
the output will be :
1

2
3
4
5
At the end of the For/Next loop, the value of I is 6, since it is incremented by
the Next I statement.
If the condition initial-value <= final-value is not true, then the for loop is not
executed.
Example 2 :

ForI=1to10Step2
Print I
Next I
In this example, I is initially 1. Since this is less than the final value (10),
statement inside the loop is executed and value of I is printed. I then becomes 3
since it is increased by step value 2. As indexuar (31 <finat-ualue (lO), condition is
true and the body of the loop is executed to print 3. The successive values of I are
1, 3, 5, 7, 9. When I becomes 9, it is incremented (increased) by 2 so the new
value of I is 11. Since 11 > 10, the condition that the index variable should be
less than or equal to final value is no longer true and the statement inside the
loop is not executed now. Thus, the output of this program is :
1

3
5
7
9
Example 3 :
ForI=1to1O
PrintI, I*I
Next I
This loop will execute 5 times. For each value of I, the body of the loop will
print the value of I and I*I (i.e., I2). so the output of this code will be :
11
24
39
416
525
Example 4 :
ForI=6tol
Print I
Next I
In this case the initial value of I is 6. Since the condition initial-ualue<= final-
ualue is not satisfied, the loop is not executed at all and control passes to the
statement after the Next I statement.
Visual Basic Loops t?'t, 175
Important Points while using the For l,oop :
1. If the step value is not specified, it takes the defaurt value 1.
2. If the step value is positive, then the loop is executed as long as the following
condition is satisfied : initial-ualue<= final-ualue
3. If the step value is negative, then the loop is executed as long as the following
condition is satisfied : initial-ualue>= finol-ualue
4. It is not advisable to change the value of the index variable inside the body of
the loop.
5. To exit the For loop, we use the statement Exit Fotr inside the body of the loop.
This will transfer control to the statement after the /Vert statement of the For
loop.
Example 5:
Write Visual Basic code to accept the user's name in a text box, and print it 5
times.
Dm I as Integer
Dim strName as String
strName = txtName.Text
ForI=1toS
Print strName
Next I
MESSAGE BOX
MsgBox is used to display a message or the value of a variable (the result of a
calculation) in a box. We now explore the MsgBox function in detail.
General S5rnta.r :
MsgBox (Prompt, [,Buttons] [,Title])
tsgBor Functloa Return Vdues :
The message box function returns an integer value to indicate which button
was pressed. The return values are represented by Visual Basic intrinsic
constants as shown in t]le table below :
Vkual Baslc Value Button Pressed
Intrlnslc Constant
vbOk I OK
vbCancel 2 Cancel
vbAlert 3 Alert
vbRetry 4 Retry
vblgnore 5 Ignore
vbYes 6 Yes
vbNo 7 No
Speci$lag the Buttons to Dlsplay :
We can speci$ which buttons to display by using Visual Basic intrinsic
constants or equivalent numbers.
Button to Display Value Vlsual Basic Constant
OK button 0 vbOKOnly
OK and Cancel buttons 1 vbOKCancel
Abort, Retry, Ignore buttons 2 vbAbortRetryIgnore
Yes, No, Cancel buttons 3 vbYesNoCancel
Yes and No buttons 4 vbYesNo
Retry and Cancel buttons 5 vbRetryCancel
176 ft'j. Computer Sysfem.s andApplications -T.Y.B.Com.-(Sem. VI)

Specl$lng the Icons to Dlsplay :


We can speciff which icons to display by using Visual Basic intrinsic
constants or equivalent numbers.
Icon to Display Value Symbolic Constant
No icon o (None)
Critical Message 16 vbCritical
Warning query or Question mark 32 vbQuestion
Warning message or Exclamation point 48 vbExclamation
Information icon 64 vblnformation
If we want to display buttons and icon, we use a plus sign to add the two
values together.
Examples: I'lessage Box Example t':
1. Display a message box with the prompt
"This is an example of a message box"
and show the OK and Cancel buttons
along with the Information icon.
R = MsgBox "This is an example of a
message box', vbOKCancel +
vblnformation, "Message Box Example" Fig. 13.1
2. Display a message box with the prompt
"This is a message box" and show the
[xample 2
E
Yes, NO and Cancel buttons along with
the Question mark icon. t"p This is a message box

R = MsgBox("This is a message box",


vbYesNoCancel i _vbQuestion, "Example hlo
lilrll I
2"1
Fig. 13.2

PROGRAMMING EXERCISES
1. To compute the Factorial of a Nunber:
Write Visual Basic code to accept a number from the user and calculate its
factorial. Print the factorial in a message box. [Note : Factorial of a number is the
productof allnumbers from l tillthatnumber. E.g., factorialof 4 is 4 x3 x2x I,
ie., 241. while running this program, do not enter a number greater than 7.
Form Design:
r Factorial xl
lblNum Erter a Number
t<tNum

cmdCalc Exit
cmdExit

cmdClear

Ftg. 13.3
Visual Basic Loops ,?'t' 177
Code:
'Purpose: To compute the factorial of a number
'Author: Mukesh N Tekwani

Private Sub cmdCalc_Ctick(f


Dim I As Integer
Dim N As Integer
Dim F As Integer

F= f initialiseFto 1

N = Val(txtNum.Text)

ForI=1ToN
F=F*[
Next I

MsgBox ("Factorial = " & F)


End Sub

Hvate Sub cmdClear_Click(f


txtNum.Text = ""
txtNum.SetFocus
End Sub

Private Sub cmdErit-Click(l


End
End Sub
2. To compute the sum of all nunbers up to I[ :
Create a Visud Basic project to accept a number (N) from the user and
calculate the sum of all numbers up to that number.
Form Deslgn:
r Forml FlEllxt
lblNum DrtNum

cmdCalc cmdExit

cmdClear

Ftg. 13.4
178 l't't' Computer Systems and Applications - T.Y.B.Com-(Sem. VI)

Code:
?urpose: To compute tJre sum of numbers upto N
'Author: Mukesh N. Telsrani
Hvate Sub cmdCdC-Cttcl(f
Dim I As Integer
Dim N As Integer
Dim Sum As Integer
Sum=O

N = Val(b<tNum.Text)

ForI=1ToN
Sum=Sum+I
Next I

MsgBox ("Sum of numbers is " & Sum)


End Sub

Private Sub cndClear-CllcL(f


txtNum.Text = ""
txtNum.SetFocus
End Sub

Prlvate Sub cmdDrlt-Cllch(|


End
End Sub

O&'E TIVE QI'ESTIONS


I. State whether thc follorlag.rG truG or felrc :
1. The While statement can be written at the beginning of or end of the Do statement.
2. While and Until statements can be used at the same time in a Do statement.
3. The statements in the Do/While loop are executed if the condition is tnre.
4. The statements in the Do/Until loop are executed if the condition is true.
5. The body of Do Until is executed only if tl.e loop contirruation test is True
6. In the For/Next loop, the default step value is 1.
7. We can change the valub of the index variable inside the body of the For/Next loop.
8. If the step value is positive, then the For/Next loop is executed as long as the
following condition is satislied :initial-ualuss= fina,l-ualue
9. In a MessageBox funcdon, it is not possible to determine which button was pressed
by the user.
10. Infinite loops keep repeating until ttre program is intermpted.
11. In a For-Next loop, the index variable (or counter variable) must be numeric.
12. The Step increment part of the For-Next loop is compulsory.
13. A pretest loop always performs at least one iteration, even if the test expression is
false from the beginning.
Visual Basic Loops t'jl"r' 179
U. Multiple Cholce Questlons
Select the appropriate optlon from the followlng :
l. The Do While statement marks the beginning of a Do While loop, and the Loop
statement marks the end. The statements in between are known as the of the
loop.
a) Processes Functions b)
c) Body Substance d)
2. A(n) loop evaluates its test expression before each iteration
a) Out-Test b) In-Test
-
c) Pretest d) Posttest
3. The loop is ideal for situations that require a counter because it is specifically
designed to initial2e, test, and increment a counter variable.
a) DoWhile
- b) DoUntil
c) Pretest DoUntil d) For-Next
tANsv.rERsl
I. [True : 1, 3, 5, 6, 8, 10, 11
False z 2, 4,7,9, 12, l3l
u. [(1 - c), (2 - c), (3 - d)]

lauEsrrorsl
1. Define the terms "loop" and "iteration".
2. Explain the working of the Do/While loop.
3. Explain the working of the Do/Until loop.
4. Explain the working of the For/Next loop.
5. What is the purpose of the MsgBox function?
6. Rewrite the following code using For ... Next loop.
Dim I as integer
I=25
Do while (I>l)
Print I
I=I- 1

Loop
7. Differentiate between do while loop and do until loop of visual basic giving suitable
example.
8. What is a looping statement? Differentiate between an entry controlled and exit
controlled loop.
g. Rewrite the following code using For...Next statement without affecting the output :

Dim Num As Integer


Num=1
DO WHILE Num<= 5
Num=Num+l
PRINT num;
LOOP
1O. How many times will this loop be executed?
Dim I As Integer
l=99
DoWhileI< 100
If I < 90 Then I = 99
I=I+ 1

Loop
l3/T.Y.B.Com - Com. Sys. & Appl. (Sem. - VI)
180 t"t't" Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

PROGRAIIIMING
1. Create a project to print odd (even) numbers in the range L to 2O.
2. Create a project to print the sum of odd (even) numbers between 1 and 50.
3. Write the Visual Basic code to print all numbers in the range 1 to lOO that are
divisible by 5. Use the Do/WhiIe loop.
4. Create a project to print the following table (upto N = 1O) :

Number (N) Square (N * N)


11
24
39
Use the Tab function to control output.

r??'
Practicals t't't' 181

PRACTICALS

GUIDELINES TO CRTATING A POWERPIOINT PRTSTI|TATION


The purpose of this practical is to acquaint the reader with the process of
creating a PowerPoint presentation. A PowerPoint presentation can be a useful
tool to share information with a number of viewers in a meeting or in a class. We
will use Microsoft PowerPoint to create a presentation but we will not hold your
hand through the process of creating a PowerPoint presentation. Instead we will
state some of the guidelines for creating arl effective PowerPoint presentation.
Basic Hints for a successful presentation:
o Plan for the presentation
o Do your research - get facts right, get details,
a Know your audience -whom are you showing the presentation to
o Time your presentation - 10 minutes, 15 mins,.. decide the time. Don't go
beyond 25 minutes.
o Practice your presentation - Show the presentation to your nearest
friends before it is put live in front of an audience. T
o Speak comfortably and clearly - as each slide is shown, explain the
details of each of the points on the slide.
Effective PowerPoiat Slides:
a Use design templates but avoid templates with images in the
background
o Standardize position, colors and styles - rlse same colors of text and
background on all slides
a Include only necessa4r information - because the time is limited to show
information
o Limit the information to essentials - discuss the details - don't put
everything onto the slides.
o Use colors that contrast - with dark background such as black or nary
blue, contrasting colors are white, bold yellow, bold white, bright green.
Don't use more than 2-3 colors in your entire presentation.
a Too many slides can lose your audience - as a rule of thumb you get
about 30 seconds per slide (show the slide and discuss about it). So divide
the total available time by approx 0.5 (30 secs = % minl to give you the
total number of slides.
a Never read out the slides - your audience can read! Instead, explain
points on the slide.
o Encourage your audience to ask questions, if any, after the presentation
is over. That way, there will be a smooth flow in your presentation.
Text guidelines
o Maximum 6 words a line
o Maximum 6 lines a slide - don't just type paras and paras of text
a Avoid long sentences - grammar isn't vely important, its more important
to convey the idea
o Larger font indicates more important information - use for titles
182 t"t't' Comgruter Sgstems andApplications - T.Y.B.Com.-(*m. V0

o Font size generally ranges from 18 to 48 point - a rule of thumb to decide


font size is this: font. size should be 6 times the average age of your
audience! That way people at the end of the auditorium or class can also
see the text.
a Be sure text contrasts with background - use light background and dark
text such as black text on white background. Or vice versa. Usually the
eye is more comfortable with light backgrounds and dark text. That's how
your nonnal paper is.
a Fancy fonts can be hard to read - use standard fonts like Arial, Tahoma,
or Arial Rounded MT Bold, etc
a Words in all capital letters are hard to read
o Avoid abbreviations and acronJfins
a Limit punctuation marks - avoid comma, fullstop, etc
o Avoid slide transitions but if you. must use them, use the same transition
throughout the presentation such as fade, dissolve, etc.
Graphics
o Should balance the slide
a Should enhance and complement the text, not overwhelm
a No more than two graphics per slide
o Use animation to illustrate a flow in a process, Avoid the custom
animation that is available in PowerPoint. Text flyrng in from all corners of
the screen is not only a waste of time but also irritating
hacticals D'r,'' 183

PRACTICAL 1
PREPARING A POWERPOINT PRTSENTATION ON AIT E.COMMERCE
WEBSITE

The reader is encouraged to create a PowerPoint presentation on €rn e-


commerce website. E-Commerce is discussed in this book in Module 1. What we
need to discuss in the presentation is an existing e-commerce website.
We will give here the general points to be covered in the presentation but the
reader is encouraged to use her own ideas and make the presentation more
appealing.
1. Limit the presentation to maximum 20 slides.
2. Decide on a e-commerce site - Flipkart, Arnazott, SnapDeal, Myntra, eBay,
Jabong, HomeShopl.8... there are many examples. Choose any one site.
3. Slide L : Brief history of the company - remember, "not more than 6 lines per
slide" rule!
4. Side 2 : Promoters - some information about who started the company.
5. Slide 3 : What does the site sell? Some ecommerce sites may be limited to
selling books, some tickets for events, others may sell only grocery items,
some may be for selling only furniture, while the biggest sites may sell almost
all items that one can think of!
6. Slide 4 : Funding. How did the company raise funds for this venture?
7. Slide 5 : Pricing of items - is the price of item below MRP? Are discounts
offered during special periods like festivals, or to coincide with school/college
opening
8. Slide 6 : Brands available - Is there a diversity in brands
9. Slide 7 : Payment methods: Cash-on-Delivery, credit/debit cards, coupons,
net banking, e-wallet...
10. Slide 8 : Delivery mechanism - do they deliver anywhere in the world,
anywhere in India, delivery time needed, is there ar1 express delivery option...
11. Slide 9 : Return or exchange mechanism - what is the policy of the company
on return / exchange of defective goods? Is the money refunded to the buyer
or does he get coupons for future shopping?
12. Slide 10 : What is the warranty on the products? Is the product covered
under the manufacturer's warranty or are the warrant5r terms different?
13. Slide 11 : Where are the oflices of the company located?
14. Slide 12 : Grievance redressal mechanism - what happens if a buyer has a
complaint against the services of the e-commerce site, or delivery schedule,
or product quality. How will these issues be addressed by the company.
15. Slide 13 : Revenue and growth of the company - how has it performed over
the past 2-3 years.
16. Slide 14 : Competitors - who are the competitors of the company you have
chosen to speak on? How is this company different from its competitors.
17. Slide 15 : Usability of their website. Is it easy to search for a product, are the
discounts easy to locate, are all technical specifications of a product given
clearly, are there images/video that can help in making the purchase
decision easier.
18. Slide 16 : Does the company use traditional modes of advertising such as
newspapers, TV, magazines, radio to advertise its services.
19. Slide 17 : Does the company have a presence on social media such as
Facebook, Twitter, etc.
184 jl'j!'1)' C-om4ruter Systems and Applications - T.Y.B.Com.-(Sem. VI)

20. Slide 18 : Improvements in e-commerce site such as interface, services


offered, pa5rment options, pricing, etc
21. Slide 19: Future plans of the company, acquisitions planned, products to be
added, interaction with buyers and sellers, etc.
Some of the other points you can cover are: number of users per month,
revenue per year, average time spent by a person on the site, ranking on the
search engines.
You can change the sequence of slides. After you have created the
presentation you are encouraged to upload it on the net - one of the free sites for
sharing presentations is Stdeshare.net. Here you will also find many
presentations uploaded by one of the authors (www.slideshare.net/mukeshnt).
Practicals t?"t" 185

PRACTICAL 2
SAL/TRY CALCULATIOIT

Calculation of DA, HRA, PF, Gross Salary and Net Salary using MS-Excel.
Prepare a worksheet containing Names and Basic salary of 5 employees as
shown below.
.d

Employee Number Name


,''q *_ ._t, *
Basic Salary DA
.q _E* l. - -s_.
HRA PF Gross Salary Net Salary
?. 101 Diana Fernandes 3otr)0 : I

TDz Gautam Shah 27500


4 106 Prachi Mehta 28tXlO I

5 107 Himanshu Mehta 3lfiXI


108 Prerana S 3CIO00
7 109 Varun Kumar 19000
\

Ftg. P2.1: Salary Cdculatloaa


We will calculate tJ:e DA, HRA and PF using the following formulae :
DA = 2Oo/o of basic salary
HRA: If basic salary >= 30O0O, HRA is 35o/o of basic salary. If basic salar5r >=
20OOO but less than 30O00, HRA is 25o/o of basic. If basic salary < 2O00O, HRA is
2Oo/o of basic salary.
PF is 12% of basic salary.
Gross salary = Basic + DA + HRA
Net Salary = Gross salary - PF
Let us now enter the formulae in various cells :
Cell D2 : Tlrpe the formuLa =2O/1OO * C2. Or you may t5pe =0.2*C2. Drag
this formula upto D7. Observe that all cellreferences change accordingly.
Cell E2 : I}pe the formula
=IF(C2 >= 30OOO, 35/ 10O*C2,[F(C2>=200O0, 25/ 1O0*C2, 20 I 1O0*C2))
If condition has three parts: (i) test condition, (ii) formula to use if test
condition is trre, (iii) formula to use if test condition is false. The first part of this
formula calculates the HRA, if basic >=30O00; we use the value 35/10O*C2. But
if the salary is not >= 300O0 this test condition will be false and we will reach the
third part of the first IF statement: the 3.a part is itself another IF statement:
IF(C2>=200O0, 25/LOO*C2, 2OllOO*C21. So it C2 >= 20000, the HRA is
calculated using the value 25lLOO"C2. But if this condition is also false, we will
reach the final part of the second IF statement: HRA will be calculated for
salaries <20000 using the value 2OlLOO*C2
Drag this formula upto cell E7. Observe the HRA values are calculated based
on our nested IF statement.
Cctl F2 : ffpe the formula =L2l1OO * C2. Drag this formula upto cell F7.
Cell G2 : ffpe the formula = C2+D2+82 or you can also type the formula
=SUM(C2:E2). Drag this formula down to cell G7. (F2 is not included as it is a
deduction from tJle gross salary).

\*
186 3l't'C Comlruter Sgstems and. Applications - T.Y.B.Com-(Sem. VI)

Cell H2 : I}pe the formula=G2-F2. Drag this formula down to cellH7.


The completed worksheet gives all details required and it is shown in Fig
P2.2. Save the worksheet with an appropriate name.
A B-_ c J
D F._ _ t.- .G I n
L Ernployee Number Neme Basic Salary DA HRA PF Gross Salary iNet Salery
101 Diana Fernandes 30000 6000 10$n 3600 {6sooi 4xffi
3 102 Gautam Shah 275oo 5500 6875 3300 398751 36575
4 106 Prachi Mehta 280m 5600 7000 3360 rrc6o0j 3724/J
107 Himanshs Mehta 31000 6200 10&50 3720 48OsOl 44330
6 108 Prerana S 30000 6000 1&5fl) 3600 4atmi 42f,iJo
7 109 Varun Kumar 19000 3800 3800 ?2ffi affi, 24729
a I

F\. P{2.2t Complctcd l[ortrhcct for Salety Calculatloa


Practi@ls t"r'tt' 187

PRASHCAL 3
IITCOUE TAX CAI,CULATIOIT

Prepare a worksheet containing the Name and taxable income in columns A


and B respectively from rows 1 to 26, the lirst row contains the headings and the
remaining rows contain the data. Use your own data.
Carry out the following operations on this worksheet.
1. Save the worksheet under your name followed by your roll no., question no.
e.g. MONA1232
2. Obtain the income ta>r in column C using the following income tax slabs.
Taxable Income(Q Rate
First 1,00,0OO Nil
Next 60,O0O LOo/o

Next 7O,OOO 2Oo/o


Excess 3Oo/o
3. Obtain the surcharge in column D, where surcharge is 3olo of the income tax
for those whose taxable income is above { 5,O0,OOO
4. Obtain the total tax in column E, as the sum of income tax and surcharge.
Note : We illustrate this procedure for only 5 narnes.
Part 1 : To create a new flle and seve lt
Step 1 : Open a new workbook and t5rye the data as per instructions given in
the question. A part of the worksheet looks like ttris (we have shown data only for
5 employees, but you may enter more data as per the question)

Name Taxable lncome lncsm€Tax Surcharge Total Tax


Amit gffi
Priya tssffil
Meenakshi ,l}3fi!ot
Mumtaz 245Um
Dipti s4mo!
Ftg. P3.1: Data Grtry

Step 2 : Save the workbook: After typing the data, click on the Office button
and Select Save As.. option from the menu. Save the workbook with the name
MONA1232. Replace MONA with your narne, 123 with your ro11 number, but keep
the last digit 2 as it is the practical number. Then, click on Save. The file will be
saved with name you gave. The filename extension ryilIbe .XLSX.
Part 2 : To do the income tax calculatlon ln column C:
Step 1 : Click on cell C2.lt becomes the active cell. Now type the following
formula in the Formula bar :
=IF(B2<=lOOoOO, O, IF(E}2 <= 160O00, (82'1O0OOO)*107o, IF(82 <= 23OO0O,
60000*10% + (82-160000)*20%, 60000*10% + 700OO*2Oo/o + (82-230000)*30%)))
This becomes the formula for cell C2.
188 fft" @tnputcr Sgstems and Applicafions - T.Y.B.Com--(*m- VI)

Let us analyse each part of this complicated formula:


a) The basic formula is =IF(condition, action-l, action-2)
If the condition is Tnrc, the value stored in the cell depends on the
calculations done by the part labeled ection-l. If the condition is Falsc,
tlre value stored in the cell is decided by action-2. ln our formula, the
action-2 part is again decided by another IF Statement. This is nesting of
the IF statement.
b) We break up the complex IF statement into various parts as follows, to
make it easier to understand :
Coadltloa glvea in Equlvalent rtatemeat ia Remarks
questlon Excel
First ITOO,OOO : Tax is =IF(B2<=1OOO(X), O, lf 92 <: 1OO0OO, then C2 is 0
Nil
Next 6O,OOO Tax is 1oo/o IF(B2<=16OO(X), We write (B.2- IOOOOO)
This happens when (82- 1O00OO) * 1oo/o, because there is no tax on
taxable income becomes first l,OO,OO0. So balance
1,OO,OOO + 6O,OOO i.e., taxable amount will be
1,60,OOO (B2-roo0oo)
Next 7O,OOO Tax is 2ook rF(82 <= 23OOOO, 60000*10% means lOo/o tax
This happens when 60000*10% + on income of 60000
taxable income becomes (82- 160000)*2OYo, (82-160000l*200/o means tax
1,OO,0OO + 60,000 + of 2Oo/o on income over
70,000 i.e. 2,SO,OOO 1,60,000. Remember, the
first l,O0,OOO is still tax free.
Excess 3O% 60000"10% + TOOOO2OYy + 60000*10% means lOo/o tax
This happens when (82-23OOOOY3A/o))) on 60,000.
taxable income is greater TOOOO*2Oo/o means 2OVo tax
than 2,3O,(XX) on 7O,OOO.
(82-23OOOOI* 3Oo/o means 3O%o
tax on excess over 2,3O,OOO

Step 2 : Select cell C2 and drag the Fill Handle (the littte black square on the
lower right of the ce11). Drag till you reach cell C26. Release the mouse button.
The tax calculations for each employee appear automatically. The formula for
each cell has changed so that it refers to the appropriate cells in each row.
Alternatlvely : Click on cell C2, keep SHIFT key pressed, and use the down
arrow key to go up to cell C26. Release the SHIFT key and press CTRL + D. This
will also copy the formula in all cells up to C26 and adjust the formula
accordingly.
The worksheet appears as follows :
Bic E
1 Name Taxable lncome IncomeTax Surcharge Tax
Amit 98(m0 o
Priya 158tx)O 58{X)
Meenakshi 193(n0 12600
5 Mumtaz zrH(m 24500
6 Dipti 5400m [:ilm
1 I

Fig. P3.2 : Iaconc Ta: Cdculatloas


Practicals t't'tt 189

Part 3 : To obtaln the surcharge :


Step 1 : Click on cell D2 and type the following formula and press Enter :

=IF (B2 > 500000, C2*3o/o, Ol


This means, if the value of B2 (taxable income) is greater than 5,00,000, then
surcharge is 3% of tax. It is easy to obtain this expression if you remember that
in mathematics, the word "of implies multiplication. Since tax is stored in cell
C2, 3yo of tax means C2 * 3o/o. In case the taxable income is not greater than
5,OO,O0O then surcharge is 0; this is the last part of the IF statement.
Step 2 : Click ce1l D2 and drag the Fill Handle till cell D26. This calculates
the surcharge for each employee.
The worksheet should appear as follows :
Ai B C D
1 Nan'le lncome lncome Tax ,Surcharge Total Tax
z 98XX)0 0
3 158fl)0 58[X]. 0
I
4 Meenakshi 193(n0 u_qqq. o
5 h{umtaz 2rt5fi)0 0
5 Di 540frn 113fin. 33901
?
fig. P3.3 : Surcharge Calculations
Part 4 : To calculate the Total Tar:
Step 1 : Click on cell E2 and type the following formula and press Enter:
=C2+D2 C2 is the income tax and D2 is the surcharge. So the formula C2 + D2
gives the total tax payable.
Step 2 : Click cell E2 and drag the Fill Handle till cell E26. This calculates
the total tax for each employee.
The linal worksheet should appear as follows :
A,g C D
1 Name lncome lncomeTax Total Tax
2 98tXI0 0 o
3 15flX)0 0 s8m
4 t$eenakshi' 19:xn0 0 12600
5 Mumtaz 245fiI0 2rt500 24500,
6 Di 54{Xm 113om 3390 116390
?
Ftg. P3.4 : The Flnal Worksheet after all cdculatlons
Step 3 : Save the file again by pressing CTRL + S or from the menu
190 t"t"t' Compruter Systems and Applications -T.Y.B.Com.-(Sem. VI)

PRACTICAL 4
FILTERIITG DATA.AITD GRAPHICAL RTPRESEITTATION OF DATA

Prepare a worksheet containing the name and marks in three subjects in


columns A, B, C, and D respecdvely from rows 1 to 31. The first row contains the
headings and tlle remaining rows contain data. Use your own data.
Carry out the following operations on this worksheet :
1. Save the worksheet under your name, followed by your ro11 number, and
question no., e.g., MONA1231
2. Obtain the total marks of each student in column E
3. Construct the 3D pie diagram for the totals.
4. Construct a line chart for subject 1 and subject 3.
5. Display only those students'details who have total marks exceeding 18O.
6. Display only those students'details whose nErmes begrn \rith M'.
Note : We illustrate this procedure for only 4 names.
Part 1 : To create a new lile and rave it
Step 1 : Open a new workbook and ffie the data as per instructions given in
the question.
A part of the worksheet looks like this (we have shown data only for 4
students, but you may enter data for more students as per the question)

S lloruarz:r
A B C n F

Name Subject 1 Subiect 2 :Suhject 3 Total Marks


56 57 65 188
3 57 61 59 7A7
I lueenaksh: 69 7L 8:l 223
5 Mumtaz a2 81
J- 86 249

Ftg. P4.1: Data entty

Step 2 : Save the workbook: After typing the data, click on the Office button
and Select Save As.. option from the menu. Save the workbook with the narne
MONA1231. Replace MONA with your narne, 123 urith your roll number, but keep
the last digit 1 as it is. Then, click on Save. The file will be saved witJr name you
gave. The filename extension will be .XLSX. In case you get the following error:

Microsoft Office [xcel

il
ar&.t
The t&e ltlot'lAlz3l,xlsx dready exists. Do you want to redace the existirg fb?

Tr* I ruG"-T
F\. P4.22 File Save Error

It means that the file has already been saved by that name -by you or
someone else - so save the file with your name.
Pradicals rr?'t " 191

Part 2: To obtair the total marLs of each student in column D:


Step 1 : In cell E2, type the formula =SUM(82:D2). Press Enter. Excel
immediately shows the figure 188 in cell E2.
Step 2 : Select cell D2 and drag the Fill Handle (the little black square on the
lower right of the cell). Drag till you reach cell E5. Release the mouse button. The
totals for all students appear automatically. The formula for each ce1l has
changed so that it refers to the appropriate cells in each row. For example, cell
E3 contains the formula =SUM(83:D3). f:o Itr
Part 3 : To Coastnrct the 3D pie chatt for
the totals.
Step 1 : Select the data that you want to
plot in the pie chart. In this case we want to
plot the total marks obtained by each student
along with his/her name. So select the non- \"f
"_Iil..1'_
contiguous range A1 to A5 and El to E5. Press A1rA5, El:Esl

F5 and type A1:A5, E1:E5 s!".i"r.- I I oK l[gfg_


rig. : Selectlag
range through functlon key F5

This selects the non-contiguous range Al to A5 and El to E5.. The worksheet


looks like this :

q" * -- q--*--1..,,,t,.. ..€..' --


Subiect 1 Subiect 2 Subject 3 F-otul lt'lar
55 gl 65 188
57 51 s9 1S7
a9 7L 83 223
dL 82 81 86 249

Ftg. P4.4 : I[ol-contlguou. ralge tr highlighted ln columnr A and E

Step 2 : On the Insert tab, in the Charts BrouP, click Ple


Step 3 : Choose 3D Pie Chart, say, Pie in 3-D

$ MM
Sm

Pa.-rlS
Flg. P4.5: Selecthg the 3-D Ple chart
192 I't'!o Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

The 3D pie chart is automatically created as shown below :

Total Marks
Amit
Priya
' ..
k,, .,,,''
.::.:,
,' Meenakshi

I Mumtaz

Fig. P 4.6 : 3D Pie Chatt for the glven data.


Step 4 : Save the file by pressing CTRL + S keys.
Part 4 : Construct a line chart for subJect 1 and subJect 3.
Step 1 : Select the non-contiguous range 81: E}5 and D1:D5 as explained in
SteplofPart3above.
Step 2 : Select Insert ---+ Charts ---+ Line ---+ 2D Line.
Step 3 : Click on the chart, and from the Chart Layout button, select Layout
1. Click on the Chart title and change the title to "Line Chart".
Step 4 : Along the Y axis, you will find the text "Axis Title". Click on this and
t5pe "Marks"
Excel displays the 2D line chart as shown below :

Line Chart
100

80

P60 1
G

=40 -Subject
*Subject 3
20

0
t 2

Ftg. P4.7: Thc Llnc Chart


Part 5 : Dlsplay only those students' detalk who have total marks erceediag
180,
Step I : Change the marks of Meenakshi (or any other student) so that
they are 23, L2, and 2 in the three subjects. The total changes automatically to
37. The two graphs also change automatically.
Step 2 : Select the range A1:E5 as follows: Click on cell A1. Keep the SHIFT
key pressed and click on cell E5. The required range is selected.
Step 3 : Click Data -+Sort & Filter. Drop down arrows appear next to each
column title.
Step 4 : On the drop down arrow near Total Marks, select Number Filters...
and then select Greater Than... and type 18O. This is shown in the figures below:
Practicals t't't" 193

I2
AI lAlzl
zt
zt
IzlAl
-
Sort
YFtlter
'{''

{;
f,lear
neappty
3
56
23
67
72
188
37
AT
Sldvanced { 81 85 2rl9
Sort & Filter 5 61 59 w
Ptg. P 4.8 : Eclcctlng Flltcr optlon ng. P 4.9 : Sclcc+lng Flltcr optlon

AI
zl Sort Smallcrt to !a.gc5t
zt
A' 59rt larg.rt to Smrllcst
Sor! by Color I !

I
l.
I
i

,
tlumber Eitter! I Eqmts.,,

ll "s rD I Doca Eot Equal..,

li isrz Gre.t.r fh.n.,,


'.7rr!7
C'Ji n'".qi;q;;;;...
r ,Eras
i uz+s l?rt llr.n.,.
Lrs$ thrn Or fgual fo.,,

BctUCCn,..

Iop 10,..

AboYe AYcragc

ox Crn(tl Bclgw Averagc

Custoil Eiltcr..,

Fig. P 4.1O : Fllteriag Data

Custonr AutoFiltet ? x
Show rows r#herel
Total lila*s
is greater than 18ol

OAna OE

Use ? to reprerent any sinde chareter


Use * to represer* ily series of charaters

OK Cancel

Fig. P4.11 : Custom AutoFllter


The worksheet changes so that the row corresponding to Meenakshi is not
displayed.
A I I
1 Name Total
2 56 6l 65 188
4 82 81 85 2.49

5 67 61 59 187

Ftg. P4.12 : Aftcr Flltcrlng


194 fjl't' Compier Sgstems and.Applications-T.Y.B.Com-(Sem. VI)

Patt 6 : Dlrplay only thoec lhrdGnts'dctallr shotc nancs begtn slth'R'.


Step 1 : Select the range AI:ES as follows: Click on cell A1. Keep the SHIFT
key pressed and click on cellE5. The required range is selected.
Step 2 : Click Data +Sort & Filter. Drop down arrows appear next to each
column title.
Step 3 : On the drop down arrow near Name, select Text Filters - Begins
With and then type M'and press enter.
The worksheet now displays the names of all students whose narnes begin
\rith M'.

Flt. P 4.13 : Htcrfry for lracr .t rttag Elth 'f'


Practicals t't"t' 195

PRACTICAL 5A
USE OF VLOOKUP

Prepare a worksheet containing the Name of the salesman and sales for the
months of January, February and March in columns A, B, C and D respectively
from rows I to 26, the first row contains headings and the remaining rows
contain data. Use your own data ensuring that the sales entered in a month are
minimum 100000 and maximum 300000.
Carry out the following operatlons on this worksheet :
1. Enter the following Bonus Table in columns H and I.
SALES BONUS
300000 2000
400000 3000
500000 4000
600000 5000
700000 6000
800000 7000
2. Save the worksheet under your name followed by your roll no., question no.
e.g. MONA1235
3. Obtain the total sales of each salesman in the first quarter in column E.
4. Using VLOOKUP function obtain the bonus amounts to be given to each
salesman in column F.(Note if the total sales are say 319O0O, which is above
300000 and below 400000 then the Bonus amount will be 2000)
Part 1: To create a new file and save it
Step 1 : Open a new workbook and type the data as per instructions given in
the question. A part of the worksheet looks like this (we have shown data only for
11 employees and 4 departments, but you may enter more data as per the
question)
Data Validation Step : As given in the question, we have to ensure that the
sales entered are a minimum of 5000O and a maximum of 2500O0. To ensure
that this condition is met, we will lirst put this data validation in the range B2:
. D27.
How to put data validation in cells B2:D27?
a) Select the range B2:D27 by pressing the function key F5. A "Go To" dialog
box pops up. In this dialog box, t5rpe B2:D27 in the Reference textbox.
The range B2 to D27 is highlighted.
b) In Excel click on Data menu, and then click on Data Validation. The
following dialog box pops up :

l4lT.Y.B.Com - Com. Sys. & Appl. (Sem. - VI)


196 t't't' Computer Syslems and Applications - T.Y.B.Com.'(Sem. VI)

Oata Validation

Err Alert

Ydd*irr rterb
dfowr
vdue [Jtgroretla*

t e.'q] sx Cryrd

Fig. P. 5.1 : Data Validatioa


a) In this dialog box, click on the drop down arrow in "A11ow", and select
"Whole Number"
b) Click on the drop down arrow in "Data" and select "between".
c) Type 50000 in the textbox for "Minimum".
d) Type 250000 in the textbox for "Maximum".
Now type the data for sales of the three months in columns B, C and D. If
you try to type a value outside the range 50000-250O00, Excel will give an error.

1 Name Jan Sales Feb Sales Mar Tetal Sales Bonus Sales 3ofius
2 230000 60000 300000 xx)o
r53om 900m {f,0CI00
4 1{XXx)0 2{XXm0 55000 5ffim0 'Xm
anxn mq0o0 6fin0 6fiXxt0
5 Mumtar 2flXx)o 201000 22fiXlO 6qn
7 250000 23{XDo m000 7ux,
I Dilip 65000 eo0{n0
9 7&t00 990m 1990m
Nikhil 2500m 250fin :50000,
1I NNmrsta 198000 :4flD0
12 Bhavlka 2X)500 25{nX}

Fig: P. 5.2 : Data entry


Step 2 : Save the workbook: After typing the dd.ta, click on the Office button
and Select Save As.. option from the menu. Save the workbook with the name
MONA1235. Replace MONA with your name, 123 with your ro11 number, but keep
the last digit 5 as it is the practical number. Then, click on Save. The lile will be
saved with name you gave.
Part 2 : Calculate the Total Sales for each employee
Step 1 : In Cell E'2, type the formula =SUM(82:D21.
Step 2 : Select ceLlB2 and drag the fill handle till cell E27
The worksheet now looks as shown below; the Total column has been filled in
by the formula we created in cell E2.
Practicals t't't' 197

A E:C D E

t Jen Ssles Feb Sales Mar Sales Tot{l s6les B+nus Sales Bonus
2 230000 60000 s3000 343000 30mm ?000
3 155000 9{too0 100000 345000 400000 3{m0
4 li 100000 xt0000 5s000 355000 sfiXm Itfilo
5 z(nm 100ffn 360000 sqry:
6 Mumt€z 20000s 2010m 621000 qqq$.
7 250m0 23{I(m 730Ur0 TTn,J
8 Dilip 65000 20m00 190000 455000
9 Pankaj 78000 99000 1990m 376000
10 Nikhil 250000 250000 250000 750000
11 Namrata 250000 x99000 894{mO
l2 Bhavike 240060 220500 250S00 710560

Fig. P5.3 Bonus yet to be calculated

Part 3 : To compute the Bonus using the VLOOKUP function


We want to compute the bonus for each employee. The bonus payable
depends on the amount of total sales amount of each employee. This total sales
we have already calculated in Step 2 above. We now use the VLOOKUP function
to compute the bonus.
Step I : In cell F2, type the formula, =VLOOKUP(E2,$H$2:$I$7,2) and press
Enter key.
Step 2 :.Select cell F2 and drag the fill handle till cellF27
The bonus is inserted in cells F2 to F27.
The final worksheet looks as shown below :

1 Jan Sales Feb Sales MarSeles Total Sales Bcnui Sales Bonus
2 230frX) 6fix)0 53mO 3430fi) 2000 ilxxno zqx]
3 Anita 1550fi' 9fin0 lfiXXtO 3rt5(x)0 ano 4{XXX)O 3{m0
4 10(nfi] zfixx)o 55004 355{n0 ?000 s{XXx)O 4000
5 Veena 20fim{} 1fi)000 60000 36fim0 zCIoo 6{XXX}0 5000
5 Mumtaz ?o1000 z?qqry 621t)00 ryqq 70qn0 600&i
7 250000 t300m 2SI00tt 73(xm 6{rc0 s00{n0 7CI00
I Dilip 65000 zfiro(x) 190m0 45sun 3000
I PankaJ 78000 99000 19€000 376{m
10 Nikhil 250000 2500@ 25{ms0 r50(n0 qgm
11 Narnr8ta e50000 19flI00 44p000 6840m ffi.
1? Bhavika e40(Ml 120500 150{p0 710560 6000

Ftg. P5.4 : Coapleted Worksheet - With Bonus Cdculatloa

\,
198 l,'t''r" Computer Sys/ems and Applications - T.Y. B. Com.-(Sem. VI)

PRACTICAL 58
USE OF HLOOKUP
Prepare a worksheet that contains names of currencies, countries and cities
as shown below. User can enter the currency name in cell 89, and the HLOOKUP
function will be used to display the corresponding country name and city name
in cells E}6 and E!7 respectively.

I
d( A E

1 Currency tlollar Yen Pound Rupee Dinar


2 Country USA Japan UK lndia Bahrain
3 City Washington DC Tokyo London New tlelhi MEEama
4 I

I
5 I I

6 Country I

7 City I

I I
l I

9 Currency

Fig. P5.5 : To illustrate the ure of HLOOKUP functlon

In cellE}6, type the formula: =HLOOKUP(B9, B1:F3, 2, FALSE)


In cell 87, type the formula: =HLOOKUP(B9, B1:F3, 3, FALSE)
If the user t5pes Yen in cell 89, cell El6 shows Japan and cell 87 shows
Tokyo
Practbals t't,"I' 199

PRACTICAL 6
CREATING AND MANAGING A SCENARIO

, We will use the Scenario Manager feature A Eachelor's


of What - If analysis to study the effect on a Particulare ErDenditura ln€sflle
person's budget. The various expenditures Rent 11tXX) 5$0tx)
Food 14S]0
incurred and income are shown in Fig. P6.1 PhorrP Bials 5@
below: Clother 12@

This person is saving just t 45OO out of Travelling


Club
3tw
5{m
his total income of t 5OO00. We would like to lntertret 7tr)
study the effect of reducing expenditure on, Books 6@
say, Internet usage, or Club fees, or food and Health Care 15t!O

how it affects the balance inbome. EMi5 8400

Cell BL4 : Tlpe the formula Tota: Exp€nditure 455@


=SUM(B3:B 12) lncorEe Lpft 4500

Cell D15 : Type the formula =D3-814 Fig. P6.1: Income and Expeaditure
We will create a scenario to study the
effects of various budget cuts and how it increases the available balance.
Step 1 : Click on Data Menu ) Data Tools ) What-If Analysis ) Scenario
Manager.
Pract 6xlsx - Microsoft Excel
Dita

#s Edit Linki

Goat leek...

Data Jable,,,

Fig. P6.2: Location of Sceaario Maaager


The following dialog box appears (Fig. P6.3):
Scenario Manager

f-ffi
Delete

Ldrt.,,

5ummdry

Changing cellsl

Show Close

Fig. P6.3 Scenario Manager Dialog Box


2OO t't't' Computer Syslems andApplications-T.Y.B.Com.-(Sem. VI)

Step 2 : We want to create a new scenario. So click the Add button. You'Il
then get another dialogue box as shown in Fig. P6.4
Add Scenario Etrt
scenario Eame:

K17

ttrl+click cefls to select non-diacent charqirg ce$s,

Created by MUKESH TEKWANI on 10/12/201+

E
n nid"
Cancel

Fig. F5.4: Add Scenario Dlalog Bor


Here, Changing Cells shows cell K17. Don't worry about this; it is just the
active cell and we will change it later).
Step 3 : In the above dialog box, in Scenario Yalues
Scenario Name, type Original Budget. In EIB
fnter values for each
Changing Cells, type B7:B9 because we want
$E$7
to study the effect of changing expenditure on 5000
Zl $B$8
Travelling, Club fees and Internet usage. You 700
3l $B$e
will see the following dialog box (Fig. P6.5)
Click Qk in the above dialog box since we OK Cancel

don't want to change our original values. You


will now get back the Scenario Manager dialog Fig' P6.5 : Sceaario Values
box that looks like this (Fig. P6.6):
Scenario lilanager tr]IEI
Eldatl. add.

Qelete

Edit., ,

Merge,.,

Fqffi-l
ChangirE ce$s: $B$7:$E$e
Comment: Created by sYsTEIvl3 on 10i28i2014

r:E[ ' I Close

Fig. P6.6: Ilew Scenarlo Maaager Dlalog Box


Pradicals l,?'t,' 201
Step 4 : We will now create a new Scenario Talues
EIE]
scenario - in this we will enter some values.
Click the Add button again. You'Il get !r
values each of
2500
changing

the Add Scenario dialogue box back up. $B$7

2590
Type a new Name as Budget Two. The $B$s

Changing Cells area contain B7:B9. So just $B$e

click OK. You will again see the Scenario add Cancel
values dialog box. Now we will change the
values and the new values are as shown in Fig p6.7: New values for Budget
Fig. P6.7:
Scenario Manager Dialog Box looks like this now :

Scenario lrdanager
trlEl
slenariosi

add,

Qelete

f-r;-l
t-l

Berge.

Fffi*"I
Changing cek:
Commant:

r*ffi*l Close

Fig. P5.8: Scenario Manager


This dialog Box shows two budgets: the Original Budget and Budget Two.
Click on Original Budget and then click on Show button, See the values in cells
85, 86 and 87; these are the original values. Now click on Budget TWo and then
click on Show button; the values in cell 85, 86 and 87 change to the values we
gave earlier. Click the Close button in this dialog box.
Step 5 : Creating a Report from a Scenario
Click on Data Menu ) Data Tools ) What-If Analysis ) Scenario Manager.
From the Scenario Manager dialog box, click the Summary button to see the
dialog box shown in Fig. P6.9
scenario Summary EE
tyFe

\:/ 5Cenarl0 !ummary

$ scenario fivotTable report

Dls, Bl4, D3

IoK,l Cancel

Fig. P6.9: Scenario Summary

\
2O2 3l"t't' ComputerSyslems and Applications -.T.Y.B.Com.-(Sem. VI)

In Results Cell, we have type D15, 814 and D3. These are the cells which we
will use in our report. Click OK. The Scenario Summary Report is as shown in Fig
P6.10. This Summary appears in a separate worksheet which has the name
Scenario Summary.

Eil F G

1
Summary
3 [urrent Va:ue5: or

7 tBls

9
1t) T'o{J 45m TN
11 42300 455fi) 42300
13 vlofi) 50000 5{Xn0
13 Notes: Current Values column represents values ofchanging cells at
}t time Scenario Summery Report was created. Changing cells for each
15 scenario are highlighted in gray.
16

Fig. P5.1O: Sceaarlo Suumary


This report shows the effect of new budget: Observe that the balance amount
after new budget has become more (T 7700 instead of the old 4500). The total
expenditure has reduced (from t 45500 to t 4230O).

't
I
Practbals nff X 203

PRACTICAL 7A
USE OF GOAL SEEK
Goal Seek feature is used to get a particular value when we are not sure of a
starting value.
Example 1:
Let us consider a very simple exarnple. Suppose we want tJ:e product of two
numbers to be 75 and we know that one of the numbers (say A) is 15. What will
be the other number? This may seem like a trivial example, but will illustrate the
concept of Goal Seek. Here the God is 75. We are Socling the second number
(say B).
Step I : Create tJ:e following worksheet : ,d

Cell E}l:'Ilrpe 15. A {Fixed Number} 15


Cell 82: ffie 8 (trial value) Ofcourse, it is B {Unknown number} I
wrong, but we type any random number here; BesultweY$ant 120
Excel will find the correct value.
' Flg' P7'1: God scch Inlttal rrtel
Cell B3: I}rpe the formula =E}1*E}2
Vduc
We can see that our answer in cell El3 is
wrong because we want 75 in cell 83.
Step 2 : Start Goal Seek as follows :
Click on Data Menu )Data Tools ) What-If Analysis ) Goal Seek (Fig. P7.21

fcnarlo lilmgrr,.,

D*t, Irblc.,

Yf .22 Strrtfag Cod SGGL


"lj.
(ioal S+:ek tEilxl
The following dialog box appears (Fig. P7.3)
In this dialog box, "Set CelI" means "Which cell
contains the formula that you want Microsoft Excel
to use". We will use Set Cell'as 83.
The "To value" box means "What answer are you
looking for"? We want the number 75. So type 75 into
the "To value" box n.3
God Sech Dldog Bor
(ioal Seek
The "By Changing Cell" is the part you're not trrEr
sure'of. Excel will be changing this part. For us, it
was cell E}2. We're weren't sure which number, when
multiplied by 15, gave the answer 75. So type 82 into
the box.
You Goal Seek dialogue box should look as
shown in Fig. P7.4.
Flg P7.4 : God Seek:
Conplctcd Dldog Bor

)
't-
204 n?'f' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

Click OK. Excel displays the dialog box showing that it has found the
solution (Fig P7.5)
Gual Seek Status ? trl
5i*p

Pause

OK Cancel

Fig. P7.5: Solutloa Found


Step 3 : Click OK again and Excel displays the worksheet as shown in
Fig. P7.6

A Fixed
B Unknown n
Result we want

, Fig. P,l.6: Fiaal Worksheet


Example 2: Let us now consider a more practical example of the use of Goal
Seek feature.
You have started a business and are making a profit, of { 25,OOO per month.
You now decide to set a new profit Goal of { 35,O00. At the moment, you're selling
100O items at 25 each. Assume that you'll still sell 1000 items. The question is:
to achieve the new profit of 35,00O, by how much should you increase your
prices?
Step 1 : Create the following worksheet :

"--"."-S--"--. .""_F_ _"


CurrentSales F*ture S*les
Items Sold 10ffi Items Sold Lffi
Price per ltem ?3 Price Fer ltenr 25
Frofits 25$ffi frofits 25.0S0

Flg. P7.7: Original Worksheet


Cell 82: Type 1000
Cell 83: lrpe 25
Cell 84: Tlrpe the formula =82*83
Cell F2: \zpe 1000 Goa[ $eek ? rEi
CellF3: T}rpe 25
Cell F4: Tlpe the formula =F2*F3
The current price is t 25 and we want to 35000

change this price with Goal Seek.


Step 2 : Click Data Menu )Data Tools )
What-If Analysis ) Goal Seek Cancel

In the Goal Seek dialog box that appears t5rpe Fig. P7.8
the values as shown in Fig P7.8: GoaI Seek
Practicals ;|"t|'t' 2Os

Set Cell: Tlpe F4. This is the cell we want to set to a specific value (our Goal).
To Value: Type 35000. (This is our Goal - we want a profit of t 35,000)
By Changing cell: lrpe F3. The value we ca.n is the item
(selling price). So we are telling Excel that we
want to Set (fix) the value in F4 to 35000.
Goal Seek Status ? m
We want Excel to calculate F3 to achieve this Goal Seeking with Cell F4 Slen
value. So we are Seeking the value of F3. found a solution,
Pause
Click OK Target value: 35000

Exce1 displays the Goal Seek Status Current value: 35000

dialog box as shown in Fig P7.9 OK Cancel


Step 3 : Click OK in the above dialog box
and observe the values changing in cell F3 to Fig. P7,9
- Seek Status
Goal Dialog Box
35.
Thus you must sell the item at { 35 each to achieve your target of
t 35,000.
Here is the final worksheet (Fig. P7.1O):
B C D E

1 Current Sales Future S*les


Z Items Sold 1tx}0 Iterns Sold ltlm
3 Price Item E: I Price Per ltem
4 Profits 25000 Frofits 35{X}0
I
5 i i

Fig. P7.1O : Final Worksheet


206 t't'lt' Computer Syslems and Applications - T.Y.B.Com.-(Sem. VI)

PRACTICAL 7 B
USE OF SOLVER

Installlng Solver :
If the Analysis toolbar does not appear, or does not have the "Solver" button,
the add-in must first be activated.
Follow these steps to activate Solver :
1. Click on the Office button in the top left corner
2. Choose "Excel Options"
3. Choose Add-Ins in the left side vertical menu.
4. In the Manage box, click Excel Add-Ins and click Go...
[xcel Options nE-l
Popubr i.r
l/*
L-r,
FomuLt

Proofing Add-in5

Sav? Lo<ation lyp.


AdYan(cd
Adi 1it
Arii r? itrpt:i(atjor
Ercct REdcr Add-itr Btr.,luginr\Creatotld6{FPc-Er.?tAddtn-)66.df COM AddJn

IwtiE Applk.lion Add"im


AmtEir ToolPak aBtr32.rll Ex..l Add-in
ABlr!iE ToolPak - VBA atpvbaan.xlam Ex(rl Add-in
ConditioBl Sum W@d iumif,xbm tuccl Add-in
CurtoE XML Oata C!,.ilcr\Miaorott Otficc\Ofti(e1&of f RHO.DtI Do(umcnt lntp?dot
Resour(a5 Oat.lsmrttrq listsl C\..ilciwisorolt Shared\gBrt Taq\MOFI.OLI SmrtTag
Euro Curcncy Toolt cwotoo l.xhrm ExclAdd-in
Fimnrial tmbol 6mrt t E lists) C\...ils\Mi(orolt Shrred\smt Tag\MoFl.Dtl Smart Tag
H€ds ild Foot 6 e\..il.iMisorof t Offi ("\Otf iccl?\OFf nHO. DtL Dofficnt krrpcdor
Hldd.n Rowr and Columnt c\...ilcs\Mi€rorofi Otf ice\Off i(cl z\OFFRHD.DtL Do(um.nt lnspcdot
Hiddcn Worl5hecti Cl.,il.i\Microsofi Off i(r\Ofi iCGIAOFFRHD.DIL Documect Iniprdot
Intcmet Artktant VBA Cl., i(oiofi Off ic.\Off kclAUbnrnHIMLXLAi{ E(ccl A{rdir
lmBiblc Col*.nt C\...ils\Miso5olt Offi cc\Otf ielaOFfRHD.DlI Do@xrl lnspcdor
LookupWhard tookup.xlam Ex(cl Add-in
Pcrron llama louuook ?fiit rcdgier*r] e\...er\Miao!oft Shrrrd\5mrt Tag\Fl.lAME.Dtt smnft Tag
Solv.rAdd.in solvcr.xhm Ex(rl Add-in

Addjn: Exccl Rc.dtrAdd-in /


tubtish?n FoxitSoftuar.In(orpora{.d
Lo@tior e\Progr.n Filcs\Fodt lodtnnrc\F.xit Rod.{plughi\Cr.ator!65\FPc_txcdAddin_,65,d11

D.5€riptaon: Ex(cl RcaderAddjn

Mamg?:

ox Can(cl

Ftg. P 7.11: Iastdliag Solver


In the Add-Ins dialog box that appears, click on Solver Add-In and click OK.
If Excel cannot display the Solver option it will display an error message as
shown in Fig. P7.12. Click Yes, if this dialog box appears and let Excel finish
installing the add-in.
[Iicrosoft Office Excel ix

Iil
F$n.12 Eror lf Solver lt not lnrtalled
Practical"s t'lr't" 207
You should now get the Solver option as shown in Fig P7.I3
O!t!

Fig. P7.f O Solver Iastalled


Example 1:
Consider the following transportation problem. A manufacturer has 3
factories and 3 customers (warehouses). The cost of shipping goods from these
factories to customers is shown in the spreadsheet below.

.D E

1 Problem
2 I

Unit Cost Customer 1 Cr.rstomerZ Customer 3


Factory 1
5 Factory 2
Factory 3

Fig. P7.14: Traarportatlon Problen : Costs


So from the above table we observe that the cost of shipping one unit of item
from Factory 1 to Customer 1 is t 40, etc.
We formulate the transportation problem as follows :
1. Decision : Find out how many units to ship from each factory to each
customer
2. Constralnt : Each factory has a fixed supply and each customer has a fixed
demand.
3. ObJective : Minimize the total cost of shipment
Step I : Create the following spreadsbeet. Type the values as shown in each
cell.
-E
F It I

1 Problem
2
Unit Cost Customer 1 Cugtomer 2 Custorner 3
4 Factory 1
Factory 2
6 Factory 3

I
I chih6^a{ Customer 1 Customer 2 Customer 3 Total Out
Factory 1 $ tl 0 o
Factory2 o o 0 0
Factory 3 o o o 0

Tota! ln 0 0 o
Total Cost
Demand .'::li:r:,,, &.,.,..,,,,
t'l
Fig. P7. 15: Traarpottation Problem
208 t't't'' - T.Y.B.Com.-(Sem. VI)
Computer Systems and Applications

Step 2 : Type the following formula as shown against each cell.


Cell G10: =SUM(C1O:ElO)
Cell G1 1: =SUM(C 1 1:E1 1)
Cell G12: =SUM(Cl2:El2)
Cell C14: =SUM(C1O :CL2l
Cell D14: =SUM(DlO:D12)
Cell E14: =SUM(E1O:El2l
Cell I16: This cellwill contain the Total Cost of transporting goods from each
factory to each customer. Suppose cost of transporting single unit from Factory 1
to Customer 1 is 40. Then cost of transporting n units will be 40n. This is the
logic we use in finding the formula for cell 116: In cell 116, type the formula :
=(c4*c1o)+(D4*D 1O)+(E4*E10)+(C5*C 11)+(D5*D11)+(E5*E1 1)+(C6*C12)+(D6*D12)+(E6*El2l
Each bracketed part will calculate the cost of shipping from Factory n to
Customer n.
Initially this ce1l will show 0 because the shipments to all customers are still
O. The values in cells C10:E12 and. 116 will be calculated by Solver using the
Linear Programming method (LPP method).
Step 3 : On the Data tab, click Solver. Solver dialog box appears as in Fig. P7.16
Solver Parameters rEl
f-Et""*l
EqualTo: OB"* Ouh Qgalueot: 0
Close

Guess

to the Constraints: qptions

(hange
fB"*t Ail I
Qelete
t- H-rF-l

Ftg. P7.16: Solver Parameters


Step 4:
i) In this dialog box, click inside "Set Target Cell" and click on cell 116.
ii) In "Equal To: ", click on Min. We select Min as we want to minimize ttre
Total Cost that appears in cell I16.
iii) Now click inside "By Changing Cells". Click on cell C1O. Then, keeping the
SHIFT key pressed, click on cell E12. The range shown inside this box will
now be: $C$10:$E$12. We are telling Excel that we want to Minimize 116
(Target cell), by changing the values in cells C10:E12.
iv) Click inside the "Subject to the Constraints" box and click Add button.
The following dialog box appears :
Add Constraint
EI
Cell Reference: Constraint:
$c$14 I

OK Cancel Add Help

Ftg. P7.17: Addiag Constralnts


Practicals t't"t" 209

When this dialog appears, Cell Reference and Constraint will both be empty.
C1ick inside "Cell Reference" and click on cell C14. Change the inequality from <=
to =. Click inside "Constraint" and click on cell C16. This tells Excel that the
constraint is value of cell C14 should be equal to value of cell C16.
Click on Add button and repeat the procedure for cells :
(D14 and D16)
(E1a and E16)
(G10 and I1O)
(G11 and I11)
(G12 and I12)
Click on OK. Dialog box as shown in Fig. P7.18 appears.
Solver Parameters EI
5et Target Cell:
Equal Tor O Nu* 0 Nic O gahe of : 0
Close
Ey fhanging Cells:

$c$10:$E$12 [uess

5gbject to the Constraints: Stions


$c$14 = $c$16 add
$D$la = $D$16
$E$la = $E$16 !hange
$c$10 = $$10 All
$G$ll = $I$11 Qelete
Help

Ftg. P7.18 : Solver Paramctcrr slth Coartralatc

Step 5: Click on Options button in above dialog box. It brings up the Solver
Options dialog box (Fig. P7.19)
Solver Options tr
Max Time: |E*] seconds OK

Iterations: 100 Cancel

Precisionl 0,000001 Model,

Tolerance: 5 Model

Convergence: 0.0001 Help

plAssume Linear gdel f] Ur* Automatic 5caling


[l Assume f,lon-t{egative fl show Iteration $esults
Estimates Derivatives 5earch

@ tgngent O forward @ gewton


O guadratic 0 Eentral Q Cgniugate

Flg. P7.19: Solver OPtioar


21O ,:d,,t @mputer systems and Appliqtiotrs - T.Y.B.com.-(sem. vI)

In Fig P7.Lg, select "Assume Linear Model". Keep other settings as shown in
this Figure and ctck OK. You will again see the Solver Parameters dialog box
(Fig. P7.18).
Stcp 6 : Click on Solvc in Solver Options didog box. The Solver Results
dialog box appears (Fig. P7.2Ol.
Solver Results lxl
Solvar fourd a sd:tlsr. il cpnttr**s a-ld o*i*
cor*ims ue sffi, Rcpsts

Scnsitlvity
tirdts \

relI Crxd

W. n.n: lotuor Romltr


Click OK in this dialog box. Dont malre any other changes in this didog box.
Solver cdculates the vdues in range CIO:El2 (Shipments) and finds that the
minimum total cost is 2360O.
The final worksheet is shown in Fig. P7.21.
r.d ., A, B c DIE *F',. . .,",,. 9.',, t JT _.-' !,___,-
Transportation I

7 I
i

3 UnitCost Customer 1 Customer2 Customer 3


4 Factory I
) Factory2
6 Factory 3
7 I
I I

I I
I
I I

Shipment Customer I Customer2 Customer 3 TotalOut Supply


Fectory 1 o 100 0 100
I Factory2 o 1{n 100 zffi
Factory 3 2fi' o 100 3fl,
3 I
I

Totalln 2fi, 200 200


I
I
I
I Total Cost
16 Demand I

17
f[.
Trurportetloa DloUcu Solvcdt
P7.21:
We can see that Total Out values match the Supply capacit5r of each factory.
Also, the Total In matches the Demand of each Customer. Total Cost is
minimized to 26000.
Try changing the values in the range C1O:E12, keeping in mind the
constraints in ranges G1O:G12 and C16:E16. You will observe that in all cases
the Total Cost is more than 26000 and Solver has got an optimized solution.
Visual Basic Practicals
Practicals n?'r' 211

PRACTICAL 8
Develop a project in VB to design a suitable form to add two numbers and
display their sum.
Solution :
Step 1 : Design the form as shown in Fig. P. 8.1 below.
t Projectl - Forml (Form) r!E']flrr
i Sum of Twu Variables

Numl

Num 2

5um

Qear
,, s:l 1,, n'- |

Fig. P. 8.1 : Sua of tvo varlables


Controls and their properties :

ObJect Property Value


Form Name frmSum
Caption Sum of TWo Variables
Label Name lblNuml
Caption Numl
Label Name lblNum2
Caption Num2
Label Name lblSum
Caption Sum
Command Button Name cmdClear
Caption &Clear
Command Button Name cmdSum
Caption &Sum
Command Button Name cmdQuit
Caption &Quit
Text Box Name txtNuml
Text
Text Box Name txtNum2
Text
Text Box Name txtSum
Text
lS/T.Y.B.Com- Com. Sys. & Appl. (Sem. -VI)
212 jl"9'lt' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

Step 2 : Type the following code in the code window


Code:
'Purpose: To add two numbers
'Author: Mukesh N Tekwani

Hvate Sub cndCalc_Cltck(|


Dim a As Integer
Dim b As Integer
Dim s As Integer

a = txtNumL.Text
b = txtNum2.Text
s=a+b
txtSum.Text = s

End Sub e

Hvate Sub cmdClear_CHck(f


txtNuml.Text = ""
txtNum2.Text = ""
txtSum.Text = ""
b<tNuml.SetFocus
End Sub

Private Sub cmdQutt_Cltck(f


End
End Sub

Step 3 : Run the program and veri$r the output


Practicals t't't" 213

PRACTICAL 9

Develop a project in VB to design a suitable form to enter sales and calculate


and display the bonus which is 10olo of sales.
Solution:
Step 1 : Design the form as shown in Fig. P. 9.1 below.

t Borus Calculation
Sales _l-
I
:l

I
falculate C!*a; ouit l::
t..

Fig. P.9.1 : Bonus Cdculation


Controls and their properties :

Object Property Value


Form Name frmBonus
Caption Bonus Calculation
Label Name lblSales
Caption Sales
Label Name lblBonus
Caption Bonus
Command Button Name cmdCalculate
Caption &Calculate
Command Button Name cmdClear
Caption C&lear
Command Button Name cmdQuit
Caption &Quit
Text Box Name txtSales
Value
Text Box Name txtBonus
Value
214 t"t't' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

Step 2 : Type the following code in the code window


Code :
Author: Mukesh N Tekwani
Purpose: Bonus Calculation

Prlvate Sub cmdCalc_Click(f


Dim s As Integer 'sales
Dim b As Double 'bonus

s = txtSales.Text
b = 0.1 * s 'bonus = lOo/o of sales

txtBonus.Text = b

End Sub

Prlvate Sub cmdClear_Click(f


b<tSales.Text = ""
txtBonus.Text = ""
txtSales.SetFocus
End Sub

Private Sub cndQuit_Cltck(f


End
End Sub

Step 3 : Run the program and veriSr the output


Prac,tbaLs
l,'t't,' 215

PRACTICAL 1()

Write a project in VB to design a suitable form to enter salary and calculate


and display the DA which is 90% of salary.
Step 1:
Design the form as shown in Fig. p. 10.1 below.

t Salary Calculatian trtr

Fig. P 1O.1 - DA Calculatioa

Controls and their properties :

ObJect Property Value


Form Name frmDA
Caption Salary Calculations
Label Name lblBasic
Caption Basic Salary
Label Name IbIEA
Caption DA
Text Box Name txtBasic
Value
Text Box Name txtDA
4D
Value
Command Button Name cmdCalc
Caption &Calculate
Command Button Name cmdClear
Caption C&lear
Command Button Name cmdQuit
Caption &Quit

Step 2 : $pe the following code in the code window


216 t"t"t' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

Code:
'Purpose: DA Calculation
'Author: Mukesh N Tekwani

Hvate Sub cmdCalc_Click(f


Dim b As Integer 'basic salary
Dim da As Double 'DA

b = txtBasic.Text
da = O.9 * b 'since DA is 9Oo/o of basic salary
txtDA.Text = da
End Sub

Hvate Sub cmdClear_CltcL(l


txtBasic.Text = ""
txtDA.Text = ""
txtBasic.SetFocus
End Sub

Private Sub cmdQutt_Cltck(f


End
End Sub

Step 3 : Run the program and veriSr the output


Practicals t'g"t' 217

EXTRA PRACTICALS FOR PRACTICE


PRACTICAL 11
Create a project with the following specilications :
a) It allows the user to input information and then display the output for a
mailing label.
b) Use text boxes for first narne, last name, date of birth, street address, city,
state and PIN code.
c) Give meaningful names to textboxes and set the initial Text properties to
blank and appropriate labels to each text box to tell the user which data
will be entered into each text box.
d) Use command buttons for Display Label lnfo, Clear, Print Form and Exit.
e) A click event on the DISPLAY command button will display information in
the following format as the caption of a label :
Line 1 - The first name and last name concatenated together
Line 2 - Date of Birth
Line 3 : The street address
Line 4 - The cit5r, state and PIN code concatenated together (make sure to
concatenate a comma and a space between the city and state using ", " and two
spaces between the state and PIN code.
Solutlon:
Step 1 : Design the form as shown in Fig. P. 1 1.1 below :

i Mailing Labels tr x
First Name txtFName

Lsst Name brtlName

Date o1 bftDOB

Sheet,Address
txtStrAdd
I--..
.. State
I
I
I

PIN Code
:.:...::_:::..:::::

Eisd9y Dea Prirf Exit

Fig. P. 11.1

I
218 t"t"t" Computer Syslems and Applications - T.Y.B.Com.-(Sem. VI)

Controls and thelr properties :

Object Property Value


Form Name frmMlglabels
Caption Mailing Labels
Label Name lblFName
Caption First Name
Label Name lblLName
Caption Last Name
Label Name lblDoB
Caption Date of Birth
Label Name lblStrAdd
Caption Street Address
Label Name lblCity
Caption City
Label Name lblState
Caption State
Label Name IbIPIN
Caption PIN Code
Text Box Name txtFName
Text Box Name txtlName
Text Box Name txtDOB
Text Box Name txtStrAdd
Text Box Name txtCity
Text Box Name txtState
Text Box Name txtPlN

Step 2 : In the code window, t5rpe the following code


?urpose: Print Mailing label
'Author: Mukesh N Tekwani

Private Sub cmdClear_Click()


'Clear all text boxes and set focus to the first text box
txtFName.Text = ""
txtlName.Text = ""
txtDOB.Text = ""
txtStrAdd.Text = ""
txtCity.Text = ""
txtState.Text = ""
txtPlN.Text = ""

txtFName.SetFocus
End Sub
Pradicab ,'t'tf 219
Hvate Sub cmdDisplay-Cltck(f
'Display all the info as the caption of the label lbllnfo
lbllnfo.Caption = "Name: " & txtlName.Text & u' & _
txtFName.Text & vbCrLf
Caption = lbllnfo.Caption & "Date of Birth: " & _
brtDOB.Text & vbCrlf
lbllnfo.Caption = lbllnfo.Caption & "street Address: " &
-
txtStrAdd & vbCrlf
lbllnfo.Caption = lbllnfo.Caption &'City-State-Zip: " & _
txtCity
lbllnfo.Caption = lbllnfo.Caption & " & txtState
lbllnfo.Caption = lbllnfo.Caption & " & txtPIN
End Sub
Private Sub cmdPrint-Click(f
Printer.Print
Printer. Print Tab(2O) ; "Information"
Printer.Print ; lbllnfo.Caption
Printer.EndDoc
End Sub

Private Sub cmdExit-Cltck(f


End
End Sub

Step 3 : Run the program and check the output.


220 t,'t'l,' Computer Sgstem-s and Applications - T.Y.B.Com.-(Sem. VI)

PRACTICAL 12

In retail sales, management needs to know the average inventory figure and
the turnover of the merchandise. Create a project that allows the user to
il Enter the beginning inventory
ii) The ending inventory
iii) The cost of goods sold
On the form: include labeled text boxes for the beginning inventory, the
ending inventory, and the cost of goods sold.
After calculating the answers,
il Display the average inventory, and
iil The turnover, fornatted in labels
Include command buttons for : Calculate, Clear, Print Form, and Exit
The formulae for the calculations are :
Average Inventory = (Beginning Inventory + Ending Inventory) / 2
TurnOver = Cost of Goods sold / Average Inventory
Note :
il The average inventory is expressed in dollars, and
ii) The turnover is the number of times the inventory turns over.
Code : Include procedures for the click event of each command button.
Display the summar5r information in labels :
i) Format the average inventory as currency ,and
ii) The turnover as a number with one digit to the right of the decimal

Test Data:
Beginning Ending Cost of
Iaveatoty Iaventoty Goods sold
58,500 47,OOO 4,O0,OOO

75,300 13,600 5,15,4OO


30,000 19,600 48,000

Check Figures :

Average Turnover
Iaventory
52,750.O0 7.58
44,450.OO r 1.60
I 1,300.00 4.25
Practicals t ?,t , 221
Solution :
Step 1 : Design the form as shown in Fig. P. 12.1 below

lblEegtnlnv

lbllaput lblTurnOver

Bfirrnorer
lblAqglnv
EtAqhv
lblSummary
ftcost
txtEndlrv lblCost

bGBegintnv
lblEndlnv

Fig. P. 12.1
Controls and their propertics :
Object Property Value
Form Name frmlnventory
Caption Inventory
Label Name lbllnput
Caption Input Data
Label Name lblBeginlnv
Caption Beginning Inventory
Label Name lblEndlnv
Caption Ending Inventory
Label Name lblCost
Caption Cost ofgoods sold
Label Name lblSummary
Caption Summar5r
Label Name lbLAvgInv
Caption Average Inventory
Label Name lblTurnOver
Caption T\rrnover
TextBox Name txtBeginlnv
TextBox Name txtEndlnv
TextBox Name txtCost
TextBox Name txtAvglnv
TextBox Name txtTurnOver
Command Button Name cmdCal
Caption &Calculate
Command Button Name cmdClear
Caption C&lear
Command Button Name cmdPrint
Caption &Print
Command Button Name cmdExit
Caption E&xit
Line Name Linel

t
222 t't'3o Comgruter Sgslems andAppliqtions -T.Y.B.Com-(*m. VI)

Step 2 : Tlpe the following code in the code window

Code:
'Purpose: Calculate average inventory and turnover.
'Author: Mukesh N Tekwani

Private Sub cmdCdc_Click(f


'calculating average inventory, and turnover

Dim q1 , e2, g,, cost, turnover As Double

q1 = Val(txtBeginlnv.Text)
q2 = Val(txtEndlnv.Text)
cost = Val(txtCost.Text)
q = (q1 + q2l /'2
turnover=cost/q

txtAvglnv.Text = FormatCurrency(q, 2)
txtTurnOver.Text = FormatNumber(turnover, 2)
End Sub

Private Sub cmdClear_Click(f


'Clear all text boxes and set focus to the first text box
txtBeginlnv.Text = ""
txtEndlnv.Text = ""
txtCost.Text = ""
txtAvglnv.Text = ""
txtTurnOver.Text = ""

txtBeginlnv.SetFocus
End Sub

Private Sub cmdPrlnt_Click(f


PrintForm
End Sub
Private Sub cmdExlt_Cltck(f
End
End Sub

Step 3 : Run the program and check that the output tallies with that given in
the table above.
Practbals t't't" 223

PRACTICAL 13
Create a project that determines the future value of an investment at a given
interest rate for a given number of years. This method gives the compound
interest. The future value is the sum of principal amount and the accumulated
interest.
Future Value = Investment amount * (1 + Interest rate) ^ years
Use labeled text boxes for the amount of investment, the interest rate (as a
decimal fraction) and the number of years the investment will be held. Display
the future value in a formatted text box as currency. Include command buttons
for Calculate, Clear, Print and Exit. Format alldollar amounts.
Test data:
Amount Rate Years Future Vdue
2000 l5o/o 5 4,O22.71
1234.56 7.5o/o ? 1533.69
Solutlon:
Step 1 : Design the form as shown in Fig. P. 13.1 below :

i Future Value

lblPrn b<tPrn

lblRate
txtRate

lblYears
txtYears

IbIFV
txtFV

lblCalc cmdClear

lblPrint cmdExit

rE. P. 13.r
Step 2 : Ilpe the following code in the code window
Code:
?urpose: Calculate future value of an investment
'Author: Mukesh N Tekwani

Prlvate Sub cmdCalc-Clickfi


'calculate the future value of an investment

Dim P As Double
Dim R As Double
Dim T As Double
224 l)'t'r' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

P = Val(txtPrn.Text)
R = Val(txtRate.Text)
T = Val(txtYears.Text)

txtFV.Text = FormatCurrency(P * (1 + R) ^ T, 2)
End Sub

Prlvate Sub cmdClear-Click(f


'clear the text boxes and set focus back to the first text box
txtPrn.Text = ""
txtRate.Text = ""
txtYears.Text = ""
txtFV.Text = ""

txtPrn.SetFocus
End Sub
Hvate Sub cndHnt-Click(f
PrintForm
End Sub

Private Sub cmdExit_Ctick(f


End
End Sub

Step 3 : Run the program and veri$ that the output tallies with that given in the
table above.
Note, while entering the interest rate, type the rate in decimal fraction. E.g.,
if the interest rate is 15olo, t5pe 0.15.
Practicals t"l,?' 225

PRACTICAL 14

Write a project which provides the following income tax slab along with the
tax rates, irrespective of gender (male or female). Design a suitable form asking
for the monthly income and gender of a person. Finally calculate and display the
total tax and annual net pay of the person.
Annual Income Tax Rate o/o

o - 1,50,000 Nil
1,50,001 - 2,00,000 lOYo
2,00,001 and above 2Oo/o

Solution :
Step I : Design the form as shown in Fig. P. 14.1 below:
i Tax Calculation trtrrxl
lbllncome fraGender

frmTax optFemale

lblAnnual
txtAnnual

lblTax
brtTax

lblNetPay
txtNetPay

cmdCalc Calculate Elea cmdClear

cmdPrint Print Elit cmdExit

Ftg. P. 14.1
Note: First draw the frame fraGender by clicking on the frame tool in the
ToolBox. After that, draw the option buttons optMale and optFemale. Donot
doucle click on the option button tool in the ToolBox as that will simply place the
option button on the form; we want the option button inside the frame so that
only one of the two options is selected.
Coatrols and their properties :
ObJect Property Value
Form Name frmTax
Caption Tax Calculation
Label Name lbllncome
Caption Monthly Income
Label Name lbLAnnual
Caption Annual Income
226 t'r?" Computer Systems and Aoplbations - T.Y.B.Com.-(Sem. VI)

ObJect Property Value


Label Name lblTax
Caption Tax
Label Name lblNetPay
Caption Net Pay
Frame Name fraGender
Caption Gender
Option Button Name optMale
Caption &Male
Option Button Name optFemale
Caption &Female
TextBox Name txtlncome
TextBox Name txtAnnual
Enabled False
TextElox Name txtTax
Enabled False
TextBox Name txtNetPay
Enabled False
Command Button Name cmdCalculate
Caption &Calculate
Command Button Name cmdClear
Caption C&lear
Command Button Name cmdPrint
Caption &Print
Command Button Name cmdExit
Caption E&xit

Note : The Enabled property of some text boxes has been set to False so that the
user cannot type anything in these boxes. The result of calculation is displayed in
these text boxes.
Step 2 : Tlpe the following code in the code window :
Code:
'Purpose : Tax calculator
'Author: Mukesh N Tekwani
Sub cmdCalc_Cltck{f
minc As Double 'monthly income
Dim ainc As Double 'annual income
Dim tax As Double
Dim netpay As Double

minc = Val(txtlncome.Text)

'calculate the annual income


ainc=12*minc
Practicals t ,'?' 227
'now calcualate tax based annual income
If ainc <= 150000 Then
tax=0
Else
If ainc >= 150001 And ainc <= 20000O Then
tax = 0.1 * (ainc - 150000)
Else
If ainc >= 200001 Then
tax = 0.1 * 5O0OO + O.2 * (ainc - 2OO0OO)
End If
End If
End If

netpay=ainc-tax

txtAnnudl.Text = ainc
txtTax.Text = tax
txtNetPay.Text ='netpay
End Sub

Private Sub cmdClear_Click(f


. 'clear text boxes and option buttons'
'and set focus to first text box.

txtlncome.Text = ""
optMale.Value = False
optFemale.Value = False

txtAnnual.Text = ""
txtTax.Text = ""
txtNetPay.Text = ""

txtlncome.SetFocus
End Sub

Private Sub cmdPrint-Click(f


frmTax.PrintForm
End Sub

Private Sub cmdExit-Clickfl


End
End Sub

Step 3 : Run the program and veriSr the output

l6lT.Y.B.Com - Com. Sys. & Appl. (Sem. - Vf


228 g?'lr' Comryter Sgslems and Applications - T.Y.B.Com.-(Sem. VI)

PRACTICAL 15

Write an application with the following specifibations :


il A single text box to enter text.
ii) Three check boxes for Bold, Italic and Underline, to format the text in the
text box.
iii) Three option buttons for Red, Green and Blue color to change the color of
the text displayed in the text box.
iv) A command button to exit the application.

Solution:
Step 1 : Design the form as shown in Fig. P. 15.1 below :

r Text Formatting Ex
lblText

txtText

fraColor fraStyle

optRed chkBold

optGreen chkltalic

optBlue chkUnderline

cmdExit

Fig. P. 15.1

Controls and thelr properties :

Object Property Value


Form Name frmTextFormat
Caption Text Formatting
Label Name lblText
Caption Enter Text
TextBox Name txtText
Frame Name fraColor
Caption Font Color
Option Button Name optRed
Caption &Red
Option Button Name optGreen
Caption &Green
Practicals ,'t't' 229

ObJect Property Vdue


Option Button Name optBlue
Caption &Blue
Frame Name fraStyle
Caption Font Style
CheckBox Name chkBold
Caption Bol&d
CheckBox Name chkltalic
Caption &Italic
CheckBox Name chkUnderline
Caption &Underline
Command Button Name cmdExit
Caption E&xit

Step 2 : Tlpe the following code in the code window :


'Purpose: Study the use of chech bor and option buttons
'Author: Mukesh N Tekrani
Private Sub chkBold-Click(f
'if Bold check box is enabled, text is displayed in Bold
'otherwise it is displayed in Normal font

If chkBold.Value = l Then
txtText.FontBold = True
Else
txtText.FontBold = False
End If
End Sub
Private Sub chkltalic-Click(f
'if Italic check box is enabled, text is displayed in
ltalic otherwise it is displayed in Normal font

If chkltalic.Value = l Then
txtText.Fontltalic = True
Else
txtText.Fontltalic = False
End If
End Sub
Private Sub chkUnderline-Click(f
'if Underline check box is enabled, text is underlined,
'otherwise it is displayed in Normal font

If chkUnderline.Value = l Then
txtText.FontUnderline = True
23O al"t't ' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

Else
txtText. FontUnderline = False
End If
End Sub
Private Sub cmdExit-Click(f
End
End Sub
Private Sub optBlue-Clickfl
'If Blue option button is selected, display text in Blue
'color. vbBlue is an intrinsic constant in Visual Basic

txtText.ForeColor = vbBlue
End Sub

Private Sub optGreen_Click(f


'If Green option button is selected, display text in Green
'color. vbGreen is an intrinsic cons.tant in Visual Basic

txtText.ForeColor = vbGreen
End Sub

Private Sub optRed_Click(f


'If Red option button is selected, display text in Red
'color. vbRed is an intrinsic constant in Visual Basic
txtText.ForeColor = vbRed
End Sub
Step 3 : Run the program, type some text in the text box, and veriff that the font
style and colors change the text.
Practbals t"t't' 231

PRACTICAL 16

Develop a project which provides the following modes of transport and fares
per unit distance. After inputting the distance and mode of travel, the program
should calculate the total bill, and print it as a caption on a label.
Mode Fare
Railway t3perkm
Fight t4perkm
Car {Sperkm
Solutlon:
We assume that the journey can be completed by one or more modes of
transport. That is, part journey by railway, part by flight and rest by car. User
must enter tJ:e distance travelled by each mode and ttre program will calculate
the grand total amount. We will also display the total amount against each mode
of transports
Step I : Design the form as shown in Fig. P. 16.1 below :
t Billing Prugranr trtr
lblMsg

lblAmountnt
Distance Amsunt
fraMode >mo{Ie fi I Iivet-*-*"

chkRail >l* Eailway bdAmtRail

chkFlight >I- Elisht RtAmtFlight

chkCar >l- csr tftAmtcar


I

lblTotalAmount
cmdClear

cmdCalc EJear cmdExit

rig. P. 16.1
Code:
'hrtpose: Travelllng Nlowance (TAl Bill preparatlon
'Author: Mukesh N. Teksani
Private Sub chkCar-Cltck()
'if the chkCar check box is selected, display the
'corresponding text box txtCar for accepting distance (

If chkCar.Value = l Then
txtCar.Visible = True
txtCar.SetFocus
Else
2s2 rr3flr Compruter Sysfems and Applications - T.Y.B.Com.-(Sem. VI)

txtCar.Visible = False
txtAmtRail.Text = O
End If
End Sub

Private Sub chkFlight_Click(f


'if the chkFlight check box is selected, display the
'corresponding text box txtFlight for accepting distance

If chkFlight.Value = l Then
b<tFlight.Visible = True
txtFlight.SetFocus
Else
txtFlight.Visible = False
' txtAmtFlight.Text = 0
End tf
End Sub

Private Sub chkRail_Click(f


'if the chkRail check box is selected, display the
'corresponding text box txtRail for accepting distance

If chkRail.Value = l Then
txtRail.Visible = True
txtRail.SetFocus
Else
txtRail.Visible = False
txtAmtcar.Text = 0
End If
Ead Sub

Private Sub cmdCalc_Clicklf


'calculate total amount for each mode of transport
'first get the distances from the text boxes
Dim dr, df, dc As Double 'dist travelled by 1ail, flight, car
Dim amtr, amtf, amtc As Double 'amount for each mode
Dim gt As Double 'grand total amount

dr = Val(txtRail.Text)
df = Val(txtFlight.Text)
dc = Val(txtCar.Text)
'now calculate and display the amount for each mode
amtr=3*dr
amtf = 4* df
amtc=8*dc
'display these amounts in the text boxes
txtAmtRail.Text = amtr
PracticaLs t't'l,' 233
txtAmtFlight.Text = amtf
txtAmtCar.Text = amtc

'calculate and display the gtand total


gt = amtr + amtf + amtc

lblTotalAmt.Caption = lblTotalAmt.Caption & " t' & gt


End Sub

Hvate Sub cndClear_Cltck(f


'clear all objects by calling the sub-procedure
ClearAll
End Sub

Private Sub Form-Load(|


lblMsg.Caption = "Click on the desired check box, and enter the
corresponding distance"

'hide the distance text boxes at form load


brtRail.Visible = False
txtFlight.Visible = False
txtCar.Visible = False

txtAmtRail.Text = 0
txtAmtFlight.Text = 0
txtAmtCar.Text = 0

End Sub

Private Sub ClearNl(f


chkRail.Value = 0
chkFlight.Value = 0
chkCar.Value = 0

txtRail.Text = ""
txtFlight.Text = ""
txtCar.Text = ""
txtAmtRail.Text = ""
txtAmtFlight.Text = ""
txtAmtCar.Text: ""
lblTotalAmt.Caption = "Grand Total"
End Sub

Private Sub cmdExit-Click(f


End
End Sub
Step 3 : Run the program and test for different combinations and values of
distances and modes of transPort.
234 ll't't' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

PRACTICAL 17

Piece workers are paid by the piece. Workers who produce a greater quantity
of output are often paid at a higher rate. Create a Visual Basic project with the
following specifications :
Form : Use text boxes to obtain the person's name and number of pieces
completed. Include a Calculate command button to display the dollar amount
earned. You will need a Summar5r button to display the total number of pieces,
the total pay, and the average pay per person. A Clear button should clear the
name and number of pieces for the current employee.
Include validation to check for missing data. If the user clicks on the
Calculate button without first entering a name and number of pieces, display a
message box. Also, you need to make sure to not display a summary before any
data are entered. You cannot calculate an average when no items have been
calculated. You can check the number of employees in the Summary event
procedure or disable the Summary command button until the first order has
been calculated.
Pieces Completed Hce patd per plece
for dl the pieces
L - 1,99 0.50
200 - 399 0.55
400 599- 0.60
600 or more 0.65
Solutlon :
Step 1 : Design the form as shown in Fig. P. 17.1 below
I Wage Calculation t;rE|Ir.l
lblSrNo
lblSerial

lblName brtName

lblPieces
brtPieces .

lbLAmount

lblSummary

cmdCalc !alcr.rlate $ummary Clear rrt I

I
cmdExit

I
cmdSummary cmdClear
Ftg. P. 17.1
Practbab l''l,"r" 235
Controls and thelr propettles :
ObJect Propcrty Vduc
Form Name frmWages
Caption Wage Calculation
Label Name lblSrNo
Caption Serial No.
Label Name lblSerial
Caption ""(blank)
Label Name lblName
Caption Name
Label Name lblPieces
Caption Pieces
Label Name lblAmount
Caption ""(blank)
Label Name lblSummary
Caption "" (blank)
TextBox Name txtName
TextBox Name brtPieces
Command Button Name cmdCalc
Caption Calculate
Command Button Name cmdSumamry
Caption &Sumamry
Command Button Name cmdC&lear
Caption Clear
Command Button Neme cmdExit
Caption E&xit
Step 2 : Tlpe the following code in the code window
Code:
'hrrpose : Wage calculatlonr
'Author: Mukerh If TeLsanl

Dim p As Integer ' no. of pieces by each worker


Dim n As Integer ' no. of workers
Dim totalpcs As Integer ' total number of pieces
Dim amt As Double ' amount for worker based on no. of pieces
Dim totalpay As Double ' total pay for all employees
Dim avgpay As Double ' average pay per person

Hvate Sub cmdCdc-Click(|


'first validate data

'check whether the Name box is left blank


If bctName.Text = "" Then
MsgBox "Enter worker name", , "Missing name"
236 ,'lft " Compfier Sgstem.s and Applimtions - T.Y.B.Com.-(Sem. Vl
txtName.SetFocus
Exit Sub 'stop processing this sub-procedure
End If

'check whether the Piecesbox is left blank


If b<tPieces.Text = "" Or Not (IsNumeric(brtPieces.Text))
Then
MsgBox "Enter number of pieces", , "lnvalid number"
b<tPieces.SelStart = O 'begin highlighting at the
lirst character
txtPieces.Sellength = len(brtPieces.Text)
txtPieces.SetFocus
Exit Sub 'stop processing this sub-procedure
End If

p = 0 'initialisation
p = Val(txtPieces.Text)

If p >= 1 And p <= 199 Then


amt=p*O.s
Else
Ifp ,= 200 And p <= 399 Then
amt=p*0.55
Else
If p >= 400 And P <= 599 Then
amt=p*0.6
Else
If P >: 600 Then
amt=p*O.65
End If
End If
End If
End If

lblAmount.Caption = FormatCurrency(amt, 2)

totalpay = totalpay + amt


totalpcs=totalpcs+p

MsgBox "Do you wish to continue?", vbYesNo


If vbYes Then
cmdSummar5r.Enabled = True
n=n*l
lblSerial.Caption = n
End If .

avgpay'= totalpay / n
End Sub
Practicals r,,'r' 237
Private Sub cmdSurnmary_Click(|
'display the summary
lblSummary.Caption = "Total no. of pieces: " & totalpcs &
vbCrLf
lblSummary.Caption = lblSummary.Caption & "Total wages: "
& totalpay & vbCrlf
lblSummary.Caption = lblSummary.Caption & "Average Pay: "
& avgpay
End Sub
Private Sub cmdClear_Click(f
'clear all object
lblSerial.Coption = ""
txtName.Text = ""
txtPieces.Text = ""
lblAmount.Caption = ""
lblSummary.Caption = ""

cmdSummary.Enabled = False
txtName.SetFocus

' initialize all variables


p=0
n=0
totalpcs = 0
amt=0
totalpay = O
avgpay = 0
End Sub

Private Sub Forn_Load(l


totalPaY = 0 'initialise
totalpcs = O
cmdSummary.Enabled = False
End Sub

Private Sub cmdExit-Click(|


End
End Sub

Step 3 : Run the program and test for different values of number of pieces.

\
238 l,'t"l," Computer Sg stem.s and Applications - T.Y.B.Com.-(Sem. V0

PRACTICAL 18

Write a project that calculates the total bill of hardware purchased from the
following list and cost :
Motherboard @t 4,OOOl-
CPU 2.9 GHz@ t 8,OOO/-
Hard disk 250 GB @ { 3,500/-
DVD Write @< 1,250/-
RAM I GB@< 1,25O/-
Cabinet @< 1,5OO/-
Monitor @< 7 ,OOO /-
Keyboard + mouse @< 75O/-
Input the quantity and display the total bill in a label.

Solutlon:
Step 1 : Design the form as shown in Fig. P. 18.1 below :

r llartlware flill l

I'x
::i:: :: :i Hardrrare-Billoffurchase i::::r;::ii:
It.m :: cod e$il&, Iotd

Mcrtherhosd Rgil.ffi1.
I

CPU 23EHa 8r8.ffit'-

8s3.ffi/.

DVD Wrle Rr 12Sl/-

.. Rs1JW.

g-rry-

Mor$tor Er 7.il01-

:::::::
R* ?E0l-

...:,.:

[*r/d" I +a gd

rE. P. r8.1

t.
Practbals t'jl r, 23g
Controls and thelr properties :
(I give here the properties of only those controls that are required in the
codef
ObJect Property Value
For all these text boxes, the Text property is "' (blank)
TextBox Name txtMBQty
TextBox Name txtcPUQty
TextBox Name txtHDQty
TextBox Name txtDVDQty
TextBox Name txtRAMQty
TextBox Name txtCabQty
TextBox Name txtvDUQty
TextBox Name txtKybdQty
For all these labels, the Caption property is "" (blank)
Label Name lblMBQty
Label Name lblCPUQty
Label Name lblHDQty
Label Name lblDVDQty
Label Name lblRAMQty
Label Name lblCabQty
Label Name lblVDUQty
Label Name lblKybdQty
Label Name lblGrandTotal
Command Button Name cmdCalculate
Caption &Calculate
Command Button Name cmdC&lear
Caption Clear
Command Button Name cmdQuit
Caption &Quit
Line Name Linel
Step 2 : I}pe the following code in the code window
Code:
'hrrpose: Hardware Bill calculations
'Author: Mukesh N Tekwanl

Private Sub cmdCalc-Click{f


Dim t1, t2, t3, t4,15, t6, t7, t8 As Integer

tl = 4000 * Val(txtMBQty.Text)
t2 = 8OOO * Val(txtcPUQty.Text)
t3 = 3500 * Val(txtHDQty.Text)
t4 = l25O * Va1(txtDvDQty.Text)
t5 = 1250 * Val(txtRAMQty.Text)
t6 : 15O0 * Val(txtCabQty.Text)
24O ,'t'r" Computer Sgstems and Applications - T.Y.B.Com.-(Sem. VI)

t7 = 7 OOO * Val(txtvDUQty.Text)
t8 = 75O * Va1(txtKybdQty.Text)
lblMBTotat.Caption = tl
lblCPUTotal.Caption = t2
lblHDTotal.Caption = t3
lblDVDTotal.Caption = t4
lblRAMTotal.Caption = t5
lblCabTotal.Caption = t6
lblVDUTotal.Caption = t7
lblKybdTotal.Caption = t8
lblGrandTotal.Caption = tl +t2+ t3 + t4 + t5 + t6 + t7 + t8
End Sub

Prlvate Sub cmdClear_Cltck(f


'clear all text boxes
txtMBQty.Text = ""
txtcPuQty.Text = ""
txtHDQty.Text = ""
txtDvDQty.Text = ""
txtRAMQty.Text: ""
txtCabQty.Text: ""
txtvDuQty.Text = ""
txtKybdQty.Text = ""

'clear all labels


lblMBTotal.Caption = ""
lblCPUTotal.Caption = ""
lblHDTotal.Caption = "u
lblDVDTotal.Caption = ""
lblRAMTotal.Caption = ""
lblCabTotal.Caption = "'
lblVDUTotal.Caption = ""
lblKybdTotal.Caption = ""
lblGrandTotal.Captiolt = rtr'
txtMBQty.SetFocus
End Sub

Private Sub cmdQuit_Click(f


End
End Sub

Step 3 : Run the program and test for different combinations and values of
distances and modes of transport.
Student is encouraged to add data validation code to the above program, i.e.,
if any quantity is less than O, an appropriate error message should be displayed
and user should be made to enter correct value (quantity ,= O).
Prac'tiqls ,"t"t" 241

PRACTICAL 19

Write a program to accept a number in a text box and print its table in the
label in a form
tx4=4
2x4=8,andsoon

Solution:
Step I : Design the form as shown in Fig. P. 19.1 below :

r [tttltiplir ntiorr Tatrle i-


trrtNum

lblTable

cmdTable lone.fr O't cmdQuit

cmdClear

EE. P. r9.1

Step 2 : Tlpe the following code in the code window


Code:
'Purpoce: Dleplay table
'Author: Mukesh N Tclraal

Private Sub cndClcar_Cltck(f


txtNum.Text = ""
lblTable.Caption = ""
txtNum.SetFocus
End Sub
242 Ct"t' Computer Systems and Applications - T.Y.B.Com.-(Sem. VI)

Hvate Sub cndQutt-Cltch(l


End
End Sub

Hvate Sub cndTeblc-Cllcl(f


Dim N As Integer
Dim P As Integer
Dim I As Integer 'required by the For...Next loop

N = Val(txtNum.Text)
lf N >= l Then
lblHdg.Caption = "Table of " + txtNum.Text

ForI=1To10
P=N*I
lblTable.Caption = lblTable.Caption + Str(I) 1 "x" +
-
Str(N) +'-'+ Str(P) + vbCrlf * " "
Next I
Else
MsgBox "Please enter a number between 1 and 100"
txtNum.Text = ""
lblHdg.Caption = ""
txtNum.SetFocus
End If
End Sub
Step 3 : Run the program and veriff the output
Practicals t't'n" 243

PRACTICAL 20

Design a form with two option buttons (Factorial and Sum of Squares). One
text box will be used to enter a number. Write two functions - one for calculating
the factorial of a number and the other to calculate the sum of squares from one
to the number entered. On click of a command button, call the appropriate
function and display the result in a label.

Solutlon:
Step 1 : Design the form as shown in Fig. P.2O.1 below :

r Furrrrl llltaltrl
brtNum

fraCalc
optFact

optSumSq

lblRes

cmdCalc q'.^dt cmdQuit

cmdClear

Fig. P.2O.1

Step 2 : Tlpe the following code in the code window


Code:
'Purporc: Dlsplay factorld or Sun of Squares - uac of optlon button
'Author: Mulesh N Telwanl

Hvate Sub cmdCdc-Cltct(f


Dim N As Integer

N = Va1(txtNum.Text)

If optFact.Value = True Then


lblRes.Caption = "Factorial = " + Str(factorial(N))
End If

l7lT.Y.B.Com - Com. Sys. & Appl. (Sem. - VI)


244 t?'31' Computer Sgs/ems and Applications - T.Y.B.Com.-(Sem. VI)

If optSumSq.Value = True Then


lblRes.Caption = "Sum of squares = " + Str(Sumsqrs(N))
End If
End Sub

Prlvate Sub cmdClear-Click(f


txtNum.Text = ""
optFact.Value = False
optSumSq.Value = False
lblRes.CaPtion = ""

txtNum.SetFocus
End Sub

Private Sub cmdQuit-Click(f


End
End Sub

Private Function factorial(N As Integerf


Dim I As Integer

factorial = 1

ForI=lToN
factorial = factorial * I
Next I
End Function

Private I'unction sumsqrs(N As Integerf


Dim I As Integer

sumsqrs = O

ForI=1ToN
sumsqrs=sumsqrs+I*I
Next I
End Function

Step 3 : Run the program and veriff the output.


Note : What is the largest number for which this code will give the correct
factorial?

t't't''
Viua tt't'l,' 245

Viaa - Ilisual Basic

1. What is GUI?
Ans. : GUI stands for Graphical User Interface - that is, the way a user interacts
with the computer.
2. What is the full form of the abbreviation IDE?
Ans. : IDE stands for Integrated Development Environment.
3. What is a procedural programming language? Give one example.
Ans. : In a procedural programming language the program specifies the exact
sequence of all operations. The sequence in which instructions will be
executed depends on the program logic. Example: C
4. What is an object-oriented programming language? Give one example.
Ans. : 6++, C#, Java and Visual Basic are object-oriented languages and they
use the concepts of object-oriented programming (OOP). An object can be
thought of as a collection of data and methods or functions that can
operate on that data.
5. What is an event-driven programming language? Give one example.
Ans. : In event-driven programming languages, programs do not follow a
sequential logic. The sequence of execution is controlled by the user.
Example: Visual Basic.
6. What is a high-level language?
Ans. : Programming languages such as Visual Basic, Java, C, C++, etc are called
high-level languages.
7. Name the different file types in Visual Basic along with their filename
extensions.
Ans. : Different file types in Visual Basic are: Project file (extension .VBP), Form
file (extension .FRM), Standard code module (extension .BAS), Custom
Controls (extension .OCX), a file containing information about each
project (extension .VBW)
8. What is an object?
Ans. : An object is an entity or a thing. Al1 the user interface elements such as
command button, text box, check button, option button, window, etc are
objects in Visual Basic. An object can be thought of as a collection of data
and methods or functions that can operate on that data.
9. What is a property?
Ans. : A property tells us something about an object. Just as a book has
properties such as number of pages, length, breadth, type of cover,
edition, etc., similarly, all objects in Visual Basic have properties.
246 jt'r'1l" Computer Systems and Applications - T-Y-B.Com-(Sem. VI)

10. What is a method?


Ans. : Methods are actions associated with objects. For example, Print, Clear,
Resize, Move.
11. What are the various types of controls available in Visual Baslc?
Ans. : The various t54pes of controls available in VB are: Textbox, Command
button, list box, check box, option button, ListBox, ComboBox, Image
control.
12. What is a container control? Give aa erample.
Ans. : A container control is any contiol that can contain other control objects.
E.g., the Form is a container control as all other controls must be placed
on it. Similarly the frame control is a container control as it can be used
to group a number of option buttons.
13. What do you understand by the term csyntax error'? Give an example.
Ans. :
Errors which occur at compilation time, such as incorrect grammar of the
source code, missing brackets, misspelling a reserved word, etc are
synta>r errors. Example: writing WHLE instead of WHILE
14. What do you understand by the term'logical error'? Give an erample.
Ans. : Errors in the logic of a program are called logical errors. For example, to
find the average of three numbers A, B and C, we must write (A+B+C)/3.
But if the programmer writes A+B+C/3 than it is a logical error as only C
is being divided by 3. Such errors cannot be detected by the computer.
15. What do you understand by the term druntime error'? Glve an example.
Ans. : Errors that occur during the execution of a program are called run-time
errors. E.g., "division by zero" error, "out-of memory" error.
16. What is an event? Give an example of an event in VB.
Aas. : An event is an action recognized by a form or a control. When a particular
event takes place, the code for that event is executed. E.9., when a
command button is clicked, the code for the click event of that button is
executed.
17. What are the three different modes in whlch Visual Basic can operate?
Ans. : The 3 different modes in which Visual Basic can operate are: Run time,
Design time, and Break time.
18. What is the default data type in Visual Basic?
Ans. : The default data type in Visual Basic is the Variant data type.
19. What is the difference between a constant and a variable?
Ans. : The value of a constant does not change during the execution of a
program. The value of a variable changes during the execution of a
program.
2O. trIhat does declaring a variable.mean? How is a variable decl,ared?
Ans. : Declaring a variable means stating its data type. The DIM statement is
used to declare a variable.
Viua 3lnal"jl' 247
21. trIhich characters erc permitted for forming a variable name?
Ans. : Alphabets and digits. are perrnitted in a variable name but a variable
name must start with an alphabet.
22. Vf/hlat are intrinsic constants in Visual Basic?
Ans. : These are system defined constants (pre-defined). These constants need
not be declared and can be used directly. Intrinsic constants start with
the prefix vb. E.g., vbRed, vbCrlf are intrinsic constants.
23. I[hat are the dlfferent types of varlables in Vlsual Basic?
Ans. : The different data types in Visual Basic are: Boolean, B5rte, Currency,
Date, Doirble, Integer, hrg, String and Variant.
24. State any fours mathematical operations in Visual Basic.
Ans. : The mathematical operators in Visual Basic are ^ (exponentiation), +, -,
*,/ (division)
25. State the relational operators in Vlsual Basic.
Aae. : The relational operators in Visual Basic €r.r€r )r )=, (, (=, <> (not equal
to). And = (equal to)
26. State the logical operators in Visual Basic.
Ans. : The logical operators in Vistral Basic are: And, Or and Not.
27. Vhrat is a textbox control used for?
Ans. : A textbox control is used for accepting any text input from the keyboard,
e.g., alphabets, digits, special characters.
28. What ls the default property of a text box?
Ans. : The default property of a text box is the Text property.
29. What is a frame control used for?
Ans. : A frame control is used for grouping a set of related controls together.
E.g. a frame control can be used to group a number of option buttons so
that the user can select only one option frorn among many.
3O. What are access Leys? How will you assiga an acceas key to a commaad
button control?
Aas. : Access key for a comrnand is the keyboard key that the user can press to
execute the command.
31. What is the TabStop propert5r of a control?
Ans. : The TabStop property determines whether focus stops on a control.
32. When will you use a message box in Vlsual Besic?
Ans. : A message box is used to convey some information to the user such as a
message if input data is invalid, or an error message or to indicate the
completion of an operation such as saving / printing a file.
83. What is the effect of double-clicklng a command button icon in the tool
bor?
Ans. : It places a command button on the form.
34. Whtch ke5nrord is used to change multiple propertles of an obJect?
Ans. : The With keyword is used to change multiple properties of an object.
248 t 't't' Computer Sys/ems and Applications - T.Y.B.Com.-(Sem. VI)

35. What does "data validation" mean?


Ans. : Input validation means checking whether the data input by the user is
correct or not. Validation may include checking for the following:check
that data is numeric, check that data is in a particular range, check that
a field has not been left blank
36. Ulhat is a menu bar?
Ans. : A menu bar contains shortcuts to performing some of the most commonly
required tasks such as saving/printing a file, copy/paste, spell check, etc.
37. What does common dialog box mean?
Ans. : A common dialog control provides a standard set of 'dialog boxes for
performing the following operations : opening an saving files, selecting
fonts, selecting colors, selecting printing options, display Help in Windows
applications.
38. What does the term "looping" mean?
Ans. : Repeating a set of statements a fixed number of times or until a condition
is true is called looping.
39. What is meant by the 'scope' of a variable?
Ans. : The visibility of a variable is called its scope. By visibility, we mean the
part of the program where that variable can be seen or the part where its
value can be used.
40. What is a function In Visual Basic?
Ans. : A'function is a code that performs certain actions and returns or gives a
value.
41. lllhich function is used to convert the text entered in a text box into an
equivalent numeric value?
Ans. : The Vat$ function is used to convert text entered in a text box into an
equivalent numeric value.
42. What does formatting of data mean?
Ans. : Formatting data means to control the way it will look on the screen or
paper.
43. State any two formatting functions in Visual Basic.
Ans. : The formatting functions in Visual Basic are: FormatNumber, Format
Currency, FormatPercent, and FormatDateTime.
44. What are the decision statements in Vlsual Basic?
Ans. : The decision statements in visual Basic are: If..Then, If...Then...Else,
If...Then...Elself, and Select...Case
45. How many operands does the logical And / Or operator require?
Ans. : The logical And f Or operator requires 2 operands.
46. How many operands does the logical Not operator require?
Ans. : The logical Not operator requires only one operand.
47. State any two statements used for looping in Visual Basic.
Ans. : Do..while loop, while...wend loop, and the For...Next loop are the looping
statements in Visual Basic.
Viua ,'r,jl, 24g
48. I[hat ls the difference between the trIhile loop and the until loop?
Ans. : In case of the Do/While loop if the condition is True, the statements in
the body of the loop are executed. But in case of Do/Until statement, the
statements are executed if the condition is False.
49. Whtch property of aa optioa button is used to test / set lts value?
Ans. : The Value property of an option button is used to test / set its value.
E.g., optScience.Value = True.
5O. What ls a procedure in Visual Basic?
Ans. : A procedure is a separate section of code which performs one or more
specific tasks; a procedure is identified by a narne.
51. I[hich are the different types of procedures in Visual Basic?
Ans. : The different types of procedures in Visual Basic are: event procedure,
sub-procedure, function procedure, and pioperty procedure.
52. State any two advaatages ofusing procedures and functions.
Aas. : The advantages of using functions and procedures are: (1) avoid repetition
of code, and (21improve code readability.
53. Iflhat is meant by the term "argumentD or "parametert in the context of
Visual Baslc?
Ans. : Variables that are passed from one procedure to another are called
arguments or parameters.
54. What are the two ways in which arguments can be passed to a function?
Ans. : Arguments can be passed to a function by value or by reference.
55. What are the two types of functions in Visual Basic?
Ans. : The two types of functions in Visual Basic are: built-in functions and
user-defined functions.
56. What ls a string in Visual Basic?
Ans. : A string is a collection of characters enclosed within quotes marks.
E.g., "University" and "203 PDR" are strings.
57. Iflhat does the Left(, function do in Visual Basic?
Ans. : This function returns characters from the left of a string.
58. Iflhat does the Right (f function do in Visual Baslc?
Ana. : This function returns characters from the right of a string.
59. What does the Mid (l function do in Visual Basic?
Ans. : This function returns specified number of characters starting from a
particular position in the string.
60. Whtch functloa is used to convert all lover case letters in a strlng to
uppcr case letters?
Ans. : The UCase$ function converts all lowercase letters in a string to
uppercase.
250 jl't"j' Computer Sysfems and Applications - T.Y.B.Com-(Sem. VI)

61. Which function ls used to convett all upper case letten ln a string to
lower case letters?
Ans. : The LCasefl function converts all upper case letters in a string to lower
case.
62. Which function is used to remove leadlng bla'nk spaees froa a string?
Ans. : The LTrim function is used to remove leading blank spaces from a string.
63. Whtch function ls used to remove tralllng blank rpaces from a strlng?
Ans. : The RTrim function is used to remove trailing blank spaces from a string.
64. Illhtch functlon ls used to remove both leading as well as tralllng blaak
spaces from a string?
Ans. : The Trim function is used to remove leading and trailing blank spaces
from a string.
65. What ls the purposc of the Tab function la Vlsual Baslc?
Ans. : The Tab function is used to print in a specified column.
Viua t''.l,, 25L

Yisa - Microsoft Dxcel


Spreadsbeet

1. What ls a template ln a rpreadrhcct?


Ans. : A template is a predesigned worksheet that can be used to create new
worksheets with the same formatting and predefined formulae. The
template worksheet contains all the formatting such as font and layout
information, conditional formatting, labels, data, tifles, and values.
2. What la neant by linkr'.9 worhbook:?
Aas. : The term linking refers to the process of creating formulas that use values
contained in another workbook. When data in one worksheet or workbook
changes, data in another worksheet/workbook also changes.
3. Deflne the erteraal reference.
Ans. : The term external reference means a reference to a cell or a range in
another workbook.
4. Deflne thc dependcnt worhbook.
Ans. : Dependent workbook is a workbook that contains links to another
workbook. A dependent workbook relies on data in another workbook.
5. Whlch rynbol ir uced to statt a formula?
Ans. : All formula must start with an = sign.
6. Whtch are the relatlonal operaton ln a rpreadsheet?
Ans. : Relational operators ar€ (, (=, ), )=, =, ().
7. What can bc the result of uslng rclatlonal operators in a foraule?
Ans. : If relational operators are used in a formula, the result can only be Trre
or False (Boolean result).
8. Whtch arc thc loglcat functlonr urcd ln rprcadsheet?
Ans. : Logical functions used are AND$, ORfl, NOTfl, TRUE$, FALSEfl, IFfl and
IFERRORO.
9. Shen lr thc retura value of AND(| fuactloa TRIrt?
Anc. : The return value of the AND$ function is Trre only if all conditions or
arguments in the ANDfl function are Tnre.
1O. Itrhen ls the return value of ORI| functlon TRIrE?
Ans. : The return value of the ORfl function is True if at least one condition or
argument in the OR() function is Trre.
11. When ls the return vdue of NOT(f functloa TRIrt?
Ans. : The return value of the NOT$ function is True if the argument in the
NOT$ function is Palse.
12. What ls a range?
Ang. : A range is a group of one or more cells in a worksheet.
252 jl'r"j' Compruter Sysfems and Applications - T.Y-B.Com.-(Sem. VI)

13. trIhat is a named range?


Ans. : If a name is given to a range (or a group of cells) in a worksheet, that
range is called a hamed range'.
14. Why is a name glven to a range? OR What are the advantages of a
named range?
Ans. : Following are the advantages of a named range:
(i) Complex formula are more readable and understandable.
(ii) It is easier to apply formatting to a named range.
(iii) Named range r.r.ses absolute references. So when we copy a formula
from one cell to another, the formula does not bhange.
15. Can a named range be deleted?
Ans. : Yes, a named range can be deleted from The Name Manager that appears
in Formulas menu.
16. Itrhat does the VLOOKUP functioa do?
Ans. : The VLOOKUP function.allows you to look up values in the first column of
a range of va-lues (table) and returns a value in the sarne row from
another column in the table.
17. What is the COUIITIF(| function?
Ans. : The COUNTIF$ function counts the number of cells within a range that
meet the given criteria. Its syntax is =COUNTIF(range, criteria). E.g.,
=COUNTIF(B2:B50, "=Pass") or =COUNTIF(B2:B50, "Pass") will count the
number of cells in the range 82 to 850 that contain the string "Pass".
18. What ls the SUMIf(l function?
Ans. : The SUMIF$ function adds the .cells which satis$r a given criteria. Its
syntax is =SUMIF(range, criteria). E.g., =SUMIF(AI:A6, ">=35") will add all
the cells in the range A1 to A6 if the values in those cells are greater than
or equal to 35.
19. trIhat is a string?
Ans. : A string is a collection of characters enclosed between double quotes
mark as follows: "Mumbai".
2O. Can a string contain non-alphabetic characters?
Ans. : Yes, a string can contain non-alphabetic characters. E.9., "40006I",
"9869012345", "DX 800" are all vatid examples of strings.
21. What does the LEFTI functlon do?
Ans. : The LEFTfl function returns a specified number of characters from the left
of a string. E.9., =LEFT("network", 3) will return the first three characters
from the left, i.e., "r7et'.
22. What does the RIcHT(l functlon do?
Ans. : The RIGHTfl function returns a specified number of characters from the
right of a string. E.g., =RIGHT("network",4l will return the first four
characters from the right, i.e., "work".
Viua n't?' 253
23. What does the MID(I function do?
Ans. : The MIDfl function returns a specified number of characters from a
string, starting at the position you speciff. E.g., =MID ("network", 3, 3)
will return the characters "two".
24. What does the LEIt(l function do?
Ans. : The LENfl function returns the number of characters in a string. E.g.,
=LEN ("network") will return 7.
25. What does the UPPER(I function do?
Ans. : The UPPERfl function converts all lower case letters in a string to
uppercase. E.9., =UPPER("network") will return "NETWORK".
26. Slhat does the LOWER(I function do?
Ans. : The LOWERfl function converts all upper case letters in a string to
lowercase. E.g., =LOWER("KEYBOARD") will return "keyboard".
27. Wh,at does the PROPERI function do?
Ans. : The PROPERfl function capitalizes the first letter in a text string and any
other letters in text that follow any character other than a letter. It
converts all other letters to lowercase letters. E.g., =PROPER("new delhi")
returns "New Delhi".
28. What does the TRIM() function do?
Ans. : The TRIMfl function removes all spaces from a text except single spaces
between words. E.g., =TRIM(" New Delhi ") returns "New Delhi". Another
example is =TRIM("New Delhi") returns "New Delhi" - 7 spaces are
removed from in between and only one space is preserved.
29. Which function returns the system date in a spreadsheet?
Ans. : The TODAY 0 function returns the current system date.
3O. Ulhat is the difference between the TODAY(f and NOW(I functions?
Ans. : The TODAY 0 function returns the current system date. But the NOWQ
function returns current date and time.
31. What is the purpose of the WEEKDAY(| function?
Ans. : The WEEKDAYfl function returns the day of the week for a date.
32. What is the purpose of the DAYSS6O() function?
Ans. : The DAYS3600 function returns the number of days between two dates.
33. What is meant by filtering data?
Ans. : Filtering data means hiding all rows except those that satisfy a particular
condition.
34. State names of any four types of charts that can be created in a
spreadsheet.
Ans. : Bar chart, line chart, column chart, and pie chart.
35. With respect to a chart, what are gridlines?
Ans. : Gridlines are lines we can add to a chart thht make it easier to view and
evaluate data.
254 t't'r' Computer Sysrems and Applications - T.Y.B.Com-(*m. VI)

36. With rcspcct to a chatt, what is a legend?


Ans. : It is a box that identifies the patterns or colors assigned to the data series
or categories in a chart.
37. With respect to a chatt, what is a data serles?
Ans. : It is a group of related data points plotted in a chart that originate from
rows or columns on a single worksheet
38. Wtth respect to a chatt, what is a category ads?
Ans. : The X-Axis is called the nCategory axis". This axis represents the different
categories that are plotted on a chart.
39. With respect to a chatt, wbat ls a value a-ls?
Ans. : The Y-Axis is called the "Value axis". This axis represents the values of
data points.
40. Whtch is the chart t5rpe that can dlsplay only one data series?
Ans. : A Pie chart is the only chart type that can display only one data series.
41. What ls the purpose of the FIXERL functlon?
Ans. : The FIXED firnction rounds off a number to a fixed number of decimal
place, fbr' ^ats the number in decimal format using a period and comma
and returns the result as a text.
42. trIhat is a Scenario in Ercel?
Ans. : A Scenario is a group of values that give different results when involved in
a calculation. It is a part of the What-If Analysis tools in Excel.
43. Where ls the Scenarlo Maaager avallable in Ercel?
Ans. : The Scenario manager is available in the Data tab under What-If analysis.
44. If,hat is the Solver tool?
Ans. : The Solver is a What-If analysis tool which finds ttre optimum value in a
target cell by changing the values in cells used to calculate the target
ce1ls.
45. What is a macro?
Aas. : The word macro means an action or a set of actions that can be used to
automate a task. Macros can speed up editing or formatting in an Excel
worksheet. They record sequences of menu selections that you :hoose so
that a series of actions can be completed in one step.
46. What are the .two ways of creatlng a macro?
Ans. : A macro can be created in two ways: (i) by recording the series of actions
and (ii) by writing the code in vBA (Visual Basic for Applications)

t"r'n"
Model Paper r??' 2s5

Model Paper
1. A. Attempt eny tuto sub-questlons from a, b, c in Visual Basic
(Tnre/Falsef l2l
a) All variables must be compulsorily declared in a Visual Basic program.
b) A declaration statement begins with tJ:e keyword Dim.
c) More than one variable can be declared in a single declaration statement.
B. Attempt any turo sub-questions from d, e, f in MS-Excel (Multiple
Cholce| l2l
d) When you are typing a formula in a cell. The first thing that must be
entered is :
i) the first cell
referenced. ii| quotation marks.
ii) parenthesis. iv) an Equal sign.
e) Excel templates have the file name extension
i) .temp iii) .xtemp
ii) .xltx iv) .xls
0 If cell A3 contains 10 and cell A4 contains 15, then what is the return
value of the formula = AND(A3 > 9, A4 < 2O)?
0 TRUE iii) 2s
ii) FALSE iv) -5
C. Attempt any slx sub-questions from g, h, i, J, k, I, E, n, o in
E-Commerce (Tnre/Falsel (61
g) M-Commerce means buying and selling of goods and services using
laptop.
h) A digital signature is a digital code that is attached to a message
electronically.
i) The scope of E-Commerce is local.
j) B2C E-Commerce is between Business to Business and consumers.
k) In SSL the URL changes from HTTP to HTTPS.
l) In Public Key Encryption there is only one key called the public key.
m) In Symmetric key Encryption both the sender and the receiver use the
same key to encr5pt and decrypt the message.
n) B2B refers to a Business selling goods to other individuals.
o) Ubiquity in E-Commerce refers to information richness.
D. Attempt aay fitn sub-questlons from pr gr rr s, t, u, v, w in E-Commerce
(Multtple Cholcef (5)
p) The full form of SET in E-Commerce is
i) Secure Socket Layer ii) Secure Socket Locket
iii) Secure Socket Loop iv) Secure Socket Liasion
q) is a part of E-Commerce.
0 B2B ii) c2c
ii| B2C iv) All of these
r) The fulI form of P2P in E-Commerce is
i) Peer to Peer ii) Person to Person
iii) Person to Peer iv) Peer to Person
s) EDI stands for-.
i) Electronic Data Information ii) Electronic Data Internet
iii) Electronic Data Interchange iv) Electronic Data Interface
256 tt'T't' Computer Syslems and Applications - T.Y.B.Com.-(Sem. W)

t) The process of converting intelligible data into unintelligible data is called


i) Encryption ii)
Decryption
iii) EDI iv)
E-Market
u) In B-Commerce the assurance that the message is not altered is known
as
i) Authentication i0
Confidentiality
iii)-.Integrity iv)
Validation
v) Sender and receiver use the same keys in
i) Symmetric key encryption ii) Asymmetric key encryption
ii| DES iv) PKi
w) The model in E-Commerce where companies earn revenue by referring
users to other websites providing products/services is called model.
i) Sales Revenue ii) Transaction Fee Revenue
iiil Advertising Revenue iv) Affiliate Revenue
2, A. Attempt any onc sub-question from a, b (E-Commercef
a) Explain advantages and limitations of E-Commerce. (81
b) Discuss any four payment systems in E-Commerce. (8)

B. Attempt arny on.e sub-question from d, e (E-Commerce)


c) Explain the terms E-Tailers and Portals. l7l
d) Discuss various security issues in E-Commerce. l7l
3. A. Attempt any one sub-question from a, b in MS-EXCEL
a) The data has been entered in a worksheet (8)
A B C D
1 ITEM NAME 2011 20t2 20r3
2 LUX 475 500 400
3 CINTHOL 150 200 100
4 PEARS 200 250 170
5 DOVE 375 400 355
6

Write the steps


i) To calculate the total in 86, C6 & D6.
ii) To construct 3-D Bar diagram.
iii) To construct Pie- Chart for the totals.
iv) To construct a line diagram for 20 11 and 2013.
b) Consider the worksheet (81
A B C
1 Cost Centers Amount in Amount in
2014 2020
2 Fees 200000
3 Hostel Charges 15000
4 Food & Clothing 25000
5 Miscellaneous 10000
6 Total Amount required
7
8
Model Paper ,'r'3l" 257
In the above worksheet the costs involved for education in 2Ol4 under four
categories is given. Catrculate the Amounts required in 2O2O taking into
account increase in fees by 5OVo, Hostel charges by 25o/o, Food & Clothing by
50% and Miscellaneous amounts by 30%. Write the steps to :

i) find the total amount required in 86 and C6 respectively.


ii) Further assuming that this target amount required in 2O2O taking into
account various other factors is say < 4,50,000 find using goal seek, the.
amount that has to be saved each month in the next 6 years in the ce1lA8
to meet this target amount assuming no interest being received on
amounts saved.
B. Attempt aay one sub-questlon from c, d ln MS-EXCEL
c) Explain the following built-in functions in MS-EXCEL l7l
1. PROPER0 2. VLOOKUP0 3. CORREL| +. SUMTF0 5. COUNTA0
TODAY} 7.FIXED()
6.
d) Consider the following worksheet showing the Basic Salary of 4
persons l7l
A B C D E
1 NAME BASIC HRA DA TAX
c DOLLY 8500
3 MINOO 27500
4 SHIRAZ 7900
5 MEHER 35000

Write the steps to compute (i)'HRA as 2Oo/o of basic salary whenever the
basic salary is 80OO or less otherwise it is 25Vo of the basic salary. (ii) DA as
l2Oo/o of basic salary or 30000 whichever is less. (iii) Tax as LO%o of
Basic+DA+HRA
4. A. Attempt any one sub-questioa from a, b in MS-EXCEL
a) A Company makes three products Bats, Racquets and Footballs whose
sale p'rice is ( 300, < 200 and ( 150 respectively. For the company to
break even, it has to achieve a total sale of < 500000 in a year. Write the
steps to find Using Solver the number of units of each of these three
products that should be sold in order to meet the desired target sale. (81
b) The following data has been entered in a worksheet (81

A B C D
1 CNO NAME PHONE BALANCE
2 4 KAPOOR 23893452 60000
3 101 DIPALI 24725467 20500
4 tt2 KULKARNI 23872569 25000
5 88 SHAMBHAVI 23891045 38000
6 49 RAJA 23800123 31500
7 54 CLERA 26598621 46830

Write steps to do the following :


i) Display the data for Balance less than 350O0.
ii) Display the data where names do not start with "K".
iii) Display the data where name is "CLERA".
iv) Display the data where the balance is between 30O00 and 50000
258 t"fr' Comprier Systems and Applications - T.Y.B.Com.-(Sem. VI)

B. Attenpt any one sub-qucltlon from c, d ln MS-E1(CEL


c) The following data has been entered in a worksheet: l7l
A B c D
I Emp Monthly Gross Pay Annual Income Income tax
No
2 234 10000
3 254 5000
4 26t 20000
5 3r2 12000
6 368 30000
Write steps to compute annual income in column C and the income tax in
column D where income tax is to be calculated as follows.
Annual Income Income tax
First 1,00,OO0 Nil
Next 2,OO,OOO lOo/o
Next 3,OO,OOO 2Oo/o

Excess 3Oo/o

d) The following data has been entered in a worksheet 17l


A B c D E F G
I RNO NAME ACC ECO COMP AVERAGE GRADE
2 101 ASHISH 55 40 60
3 103 NIKITA 80 65 63
4 104 SWATI 35 50 45
5 L02 KIRAN 42 54 66
6

Write the steps to compute AVERAGE MARKS and grade in column F and G
as per the following criteria
Average Grade
>=60 FIRST CI"ASS
<60 but >=45 SECOND CLASS
<45 but >=35 PASS CLASS
<35 FAIL

5. A. Attempt any one lub-qucatlon fron a, b h Visual Basic


a) Write a project in VB to design a suitable form to enter any two integers
and display sum of tJ:e two integers. (81
b) Write a project in VB to design a suitable form to enter age of a student
and display the message "Eligible To Vote" if age is 18 or more else display
the message "Sorry! Not eligible To Vote". (81

B. Attempt ely onc rub-questlon fron c, d in Visual Basic


c) Write a project in VB to design a suitable form to enter any positive
integer and display whether it is dMsible by 5 or not. l7l
d) Write a project in VB to compute and display the product of the series. (?)
p = ln2*3*.............*1O0.

l''l,?"
Mum. Uniu. QuestianPapers (Sem. -W (M.,2016) t t"t, 259

COMPUTER SYSTEMS AND APPLICATIONS


Semester - VI (Oct., 2016)
Note: 1. All questions are compulsory.
1. A. Attempt any two sub-questions from a, b and c in MS-Excel (True/False|. (2)
a) When data is filtered is also sorted in the ascending order.
b) Solver problems are related to a single changing cell.
c) It the data values in table are changed, then chart based on it also changes.
B. Attempt eny two sub-questions from d, e and f in vIsuAL BAsIc
(Multtple Choice). el
d) contains the controls, which on can use in the creation of a form.
a) Menu b) Tool Box
-c) Tool Bar d) Project window
e) In a VB project, the form design is carried out in the _ window.
a) Froperties b) ToolBox
c) Project Explorer d) Form window
0 A Control named 'Calculate'is most likely a
a) Label b) Image
c) Text Box d) Command Button
C. Attempt eay si:r sub-questioas from g, h, l, j, k, l, m, n, o in E-Commerce
(True/Falsef. (6)
C) E-Commerce helps us to buy products from global sellers.
h) In Public Key encr5ption there are two keys.
i) There is no difference between E- Commerce and E-Business.
j) Payment is done only by credit card in E-Commerce.
k) Digital signature is used to authenticate the identity of a person involved in
E - Commerce.
U E - markets are a virtual representation of the physical market.
m) Security is the major drawback of E-Commerce.
n) Banners and sponsorships are example of subscription revenue models.
o) Authentication ensures that the message is not read by others.
D. Attempt anf flve sub-questions from p, gr rr 8r t, u, v, w ln E-Commerce
(Muttiple Choicel. (5!
p) Commercial transactions done with the help of cell phones is called
a) E-Commerce b) M-Commerce
c) E-Business d) Sales
q) The full form of SSL in E-Commerce is
a) Secure Socket Layer b) Secure Socket Loop
c) Secure Socket Locket d)
-. Secure Socket Liaison
r) A Computer to Computer exchange of business transaction is called
a) E-Business b) Super Market
c) EDI d) E - Market
s) In online stored value systems, cards that have embedded chips that store
personal information is called
a) Debit Card b) Smart Card
' c) Credit Card d) Ideal Card
t) SET stands for
a) Secure Electronic Tape b) Secure Electronic Transfer
c) Secure Electronic Transation d) Secure Electronic Topologr
u) A Public key differs from the private key due to
a) It being used only for encr5ption b) It being used only for decryption
c) It being shorter in Length d) None of the above
v) Generally common man is familiar with form of E-Commerce.
a) B2B b) P2P c) B.2c d) C2C
l8/T.Y.B.Com - Com. Sys. & Appl. (Sem. - Vf
-
260 t'r't' Computer Sgstems and Applications - \.Y.B.Com.-(Sem. VI)

w) The process of converting readable text into scrambled text is called


a) Firewall b) DecryPtion
c) Encr5ption d) Password
2 A. Answer any one sub-question from a and b in (E-Commercef (81
a) Explain any four advantage of E-Commerce.
b) Explain B2B and P2P models is E-Commerce.
B. Answer any one sub-question from c and d in (E-Commercef 17l
c) Explain the different security aspects in E - Commerce.
d) Explain the use of public (Asymmetric) key in E - Commerce.

3. A. Attempt any one sub-questlon from a and b ln MS-EXCEL (81


a) The data has been entered in worksheet :
A B C D E F G
1 R.No Name Accounts Economics Computer Average Grade
2 t23 Mona 50 75 90
3 L24 Ganpat 80 68 72
4 r25 Prem 65 70 69
5 t26 Bindu 72 83 84
6 t27 Tina 66 60 70

Write the steps to obtain the average Marks and Grade in column F and G
respectively as per the following criteria.
Average Marks Grade
70 or more A
50 or more but less than 7O B
Less than 5O C
b) Consider the worksheet
A B C
1 Invoice No. Sales Amt Commission
2 158 65000
3 r69 45000
4. t70 32000
5. r82 15000
6. 190 55000
Write steps to calculate Commission in column C using the following Policy
Salea Amount Rate of Commission
First { 15,OOO 3o/o
Next { 25,000 5o/o
Excess 8o/o
B. Answer any one sub-question from c and d in MS-EXCEL. l7l
c) The following table shows Roll no., Name and Total marks in three tests.
A B C D E F G
1 R.No. Name Accounts MHRM Export Total Result
2 2LO Sonu 55 43 61
3 202 Pinky 80 65 63
4 203 Deep 40 50 45
5 201 Minaz 42 54 69
6 205 Sophie 70 65 80
Write steps to
i) Compute Total marks in column F
-W pct., 2016)
Mum. Uniu. Question Papers (Sem. t,'t't' 261

iil Find the result in Column G, where result is "Pass" when Total marks are
l2O or more otherwise "Fail".
iiil Find number of students whose total marks are above 165 in cell F8.
The worksheet contains the Grades of various
A B c D E F G H I J
1 Emp.No. Grade HRA Bonus Grade I II III IV
2 L24 I HRA 5000 3500 1500 750
3 345 il Bonus 10000 8000 5000 3000
4 44t IV
5 528 III
6 667 II
7 801 I
Write the steps to lind the HRA and Bonus.in column C and D respectively uqing
HLOOKUP function. Potcy table to be referred for finding the HRA and Bonus is
given in the range Gl : J3

4. A. Answer any one 8ub-qu6tio! from a and b in MS-EXCEL (81


a) The following data is entered in a worksheet regarding number of matches
won
A B c D E
1 Country 2013 20t4
2015
2 India 16 20 L9
3 Pakistan 10 t2 t4
4. Australla 20 18 2l
5 Sri Lanka t7 2r 15
Write the steps to
i) To find the total matches won by each country in cells E2 to E5.
ii) To create Column chart for matches won.
iii) To create Pie chart for matches won by India.
iv) To create a line chart for matches won in 2Ol3 and 2Ol4
b) The following Excel Sheet shows the most likely scenario of monthly
expenses.
A B C
1 Items Costs
2 Machinery 60000
3 Carriage 8000
4 Transport 30000
5 Office equipment6000
6 Postage 7000
7 Miscellaneous 3000
8. Total 1 14000

Explain steps to create Best and Worst Scenario by changing the values of
cells El2 To 87.
For Best Scenario change 83 to 5,000, B4 to 18,000, E}5 to 4,000.
For Worst Scenario change B2 to 8O,OO0, E}3 to 9,000, E}6 to 1O,O0O and then
display the summaqr
262 I"t?' Computer Syslems and Applicatbns - T.Y.B.Com.-(Sem. VI)

B. Answer ary one sub-questlon from c and d tn MS-EXCEL 171


c) The following data has been entered in a worksheet.
A B C D
1 Name Region Product ID Sales
2 Sanjay South Lux 12500
3 Minaz West Cinthol 45000
4 Arun East Babool 23000
5 Lila North Colgate 120000
6 Kiran South Dove 43000
7 Mehernosh North Liril 65000
8 Mishra East Sensod5rne 5800
9 Bina West Lifebuoy 34000
Write steps to :
i) To display only those rows where the Region is West.
ii) To display only those rows where Sales is above t40,000.
iii) To display all the rows where the Name does not contain "i".
d) Explain the following tunctions in MS - EXCEL.
1. TODAY0 2. CORRELO0 3. r.ARGE0 4. COUNTBLANK0 5. DAYS36O0
6. DATEo 7. DAY0

5 A. Answer any onc sub-questlon fron a and b in VISUAL BASIC (81


a) Write a project in VB to design a suitable form which allows the user to enter
the base and height of a triangle and calculates and displays the area of the
triangle (Area = %* Base*Height).
b) Write a project in VB to design a suitable form which allows the user to enter
Basic Salary and calculate and display the DA as 90% of Basic Salary for
Basic Salary up to {15,000 and 105% of basic salary otherwise.

B. Answer any one sub-questlon from c and d in VISUAL BASIC l7l


c) Write a project in VB to design a suitable form which allows the user to enter
two numbers and display whether the numbers are equal or not.
d) Write a project in VB to compute and display the sum of the series
2+4+ 6+8+...+20

t,'t'r'
Question Paper tr#n' 263

QUESTION PAPER
(APRTL - 2OL
Total Marks : 75 Time elowed : Zj
Note : AIl questlons are compulsoty.

l.A.Attempt any two sub-questious from a, b and c in MS-Ercel


(True or Falsef : l2l
a) PROPERfl is used to convert all the letters in a word to upper case.
b) Solver allows you to solve for more than one variable.
c) =FIXED (1234.567,1) grves 1,234.5
B. Attempt any two sub-questions from d, e and f in Visual Basic
(Multiple Cholcef : l2l
d) Visual Basic code is written in _.
a) Sub procedures b) Functions
c) Form d) Routines
e) The standard prefix for a check box button is _.
a) cbt b) . cpt
c) cbu d) chk
0 is a valid object name for a text box.
a) txtClass b) SClass
-c) txt+Class d) @txt
C. Attempt aay si.r suFquestlons fron E, h, i, J, k, I, m, r, o la E4ommerce
(True or Fdaef : (61
g) E-commerce provides the capability of buying and selling of products, services
and information on the Internet.
h) web sites *;;";;;;d;;;;es of ontine information are content provider.
i) E-tailer is an online store.
j) Authentication ensures that the message was not read by others.
k) Hacking of credit card numbers and passwords is possible in E-commerce.
l) Transaction broker earns money in the form of commission each time a
transaction occurs.
m) There is no scope for negotiations in B2C E-Commerce.
n) Digital Cash is the electronic parallel of notes and coins.
o) Payment is done only by Smart Card in E-Commerce.
D. Attempt any five sub-questions from Pr gr r, 8, t, u, v, w ilt E-Comrnerce
(Multiple Choice) : (5|
o) EDI stands for
a) Electronic data Information b) Electronic Data Interchange
c) Electronic data Interface d) Electronic data Interference
q) The fullform of C2C in E-Commerce is
a) Consumer to Commerce b) Commerce to Consumer
c) Consumer to Consumer d) -.Commerce to Commerce
r) Conversion of coded data into readable data is called
a) Firewall b) Decr5Ption
c) Enc4qption d) Password
264 t/fff Computer Systems and Applications - T.Y.B.Com.-(Sem' VI)

s) In E-Commerce, to authenticate the sender of the message we use


a) Digital Signature b) Privacy Protocol
c) Digital Sending d) Digital Protocol
t) It is a convention that all sites that use SSL connection while making a secure
connection, use instead of HTTP.
a) SMTP b) HTTPS
c) FTP - d) TCP / IP
u) The most commonly used form of pa5rment in E-Commerce is
a) Credit Card b) PayPal
c) Petro Card d) Digital Card
v) In online stored value systems, cards that have embedded chips that store
personal information is called
a) Debit Cards b) Smart Cards
c) Credit Cards d) Ideal Cards
w) is part of E-Commerce.
a) B2B b) C2C
-c) B2C d) All of these
2.A.Answer ery one sub-questlon from a and b ln E4ommerce : (81
aJ Explain any four Features of E-iommerce.
b) Explain B2B and C2C Models in E-Commerce.
B. Answer any one subquestion from c and d ln E4ommerce : 17l
c) Discuss the various pa5rment systems used in E-Commerce.
d) Explain the following in E-Commerce
i) Encyption
ii) Decyption
iii) Digital Signature
3.A.Answer etry one sub-questions froa a and b ln MS-Ercel : (8t
af Conslder the followiag worLsheet :
A B c D E
1 Emp. No Dept. Salary Allowance Bonus
c s234 Export 25,OOO
3. H533 Sales 18,000
4. w234 Accounts 23,OOO
5. K765 HR 35,OOO
6. Y654 Admin 29,OOO
Write steps to perform the followiag :
i) To compute Allowance @ Lo/o of the Salary for salary up to t 25,000 otherwise
@2o/o of the salary in Column D.
ii) To find the Bonus @ 20% of the Salary for Salary above { 30,000 otherwise
@ 14% of the Salary in Column E.
iii) To find the total bonus of all employees whose salary is below < 25,000 in cell E8.
b) Roll Number and marks are entered in columns A and B as shown in the
following worksheet. Write steps to compute Grade and the Award amount in
Column C and D respectively using HLOOKUP function. Policy table to be
referred for finding Grade and Award amount is given in the range Gl:J3.
Question Paper F*lr't* 265
A B c D E F G H I J
1 Roll No. Marks Grade Award Marks o 50 70 90
2 23r 87 Grade D c B A
3 tt2 56 Award o 150 500 1000
4 234 94
5 t23 55
6 567 77
7 345 45
8 656 69
B. Aasser any one sub-questlon'from c and d tn MD-EXCEL l7l
cf The following table shows Roll No., Name and marks scored in three subjects by
students in an exam.
A B c D E F G
I ROLL NO NAME ACC ECO COMP AVERAGE GRADE
2 101 PRTYANK 55 43 61
3 103 NIKITA 80 65 63
4 to4 SWATI 40 50 45
5 r02 KIRAN 42 54 69
Write steps to
1. Find the Average marks in Column F.
2. Assign the grade in column G using the following policy.
Average Marks Grade
70 and above o
60 to 69.99 A
Below 6O B
d) Consider the following worksheet.
A B c D
I Emp. No. Hours worked Grade Wages
2 Q234 30 I
3 R567 40 III
4 8987 28 I
5 T379 19 II
6 K237 45 TI
Write the steps to compute the Wages in column D given that the rate per hour is
< 500 < 400 and t 200 for Grade I, II and III workers respectively.

4.A.Answer any one sub-questlon from a and b ia MS-EXCEL. (8)


af The following data is entered in a worksheet regarding sales crores {)
(in of
the years 2005, 2O1O and 2015
A B c D
1 Product No. 2005 2010 2015
2 111 2L3 421 340
3 222 r58 220 130
4 333 2lo 270 195
5 444 t78 2r5 t70

\
266 ar.11Pjro Computer Sgstems and Applications - T.Y.B.Com.-(Sem. VI)

Write the steps to


1. Find the total sales in each year in the cells 86, C6 and D6.
2. Create a Column chart for the total Sales in 2005, 2010 and 2015.
3. Create a Pie chart for the sales in 2OlO.
4. Create a Line diagram for the sales in 2OO5 and 2015.
b) The following Excel worksheet contains the sale price per unit, units sold and
sales value of two products in a year.
A B c D
1 Product Price per unit Units Sold Sales value
2 A 5,OOO ro0 5,O0,OOO

3 B 3,OOO 150 4,50,000


4 9,50,OO0
For the company to break even, it has to achieve a total sale of < 1,OO,0O,OOO in a
year. Using Solver write the steps to {ind out the number of units of each of these
two products that should be sold in order to meet the desired target sale.
B. Answer any one sub-question from c aad d ta MS-EXCEL l7l
c) The following data has been entered in a worksheet :
A B C D
1 Emp. No Name Salary Contribution
2 tt23 Manoj Shah 35,000 2,50O
3 1t32 Parvin Kolad 42,OOO 3,000
4 1 r43 Javed Akhtar 20,500 1,500
5 1145 Tony D'Souza 65,OOO 4,000
6 1L67 Vinod Joshi 15,O00 1,000
Write steps to
1. To display only the rows where the salary is more than 30,OOO.
2. To display only the rows where the Contribution is up to 3,000.
3. To display only the rows where the name contains "I".
dl Explain the following functions in EXCEL.
(1) DArEO (2) CouNrAO (3) SMALL0
(4) DAys36oO (s) CoRRELO (6) MoNTHo
(7) YEAR0

S.A.Ansver any one tub-question from a aad b la Vlsual Baslc : {gl


a) Write a project in VB to design a suitable form which allows the user to enter the
Principal amount and then calculates and displays the Simple Interest using
8.57o rate of interest for 4 years. (SI = P x R x N/ 1OO)
b) Write a project in VE! to design a suitable form which allows the user to enter
Basic Salar5r and calculates and displays the HRA as l37o of Basic Salary for
Basic Salary up to ( 25,000 and 2O%o of Basic Salary otherrvise.
B. Ansrer ary ore subquestion from c and d ia vtrual Basic 2 lrl
c) Write a project in VB to design a suitable form which allows the user to enter two
numbers and displays the smaller of these two numbers.
d) write a project in vB to compute and displays the sum of the series.
3+7+11+15+...+203
fff
Mumbai University Question Paper (December 2017) trft 267

MUMBAI UNTVERSITY QUESTION PAPER

December -2017
TimeAllowed:2% Hours Total Marks : 75

N.B. 1. All questions carry equal marks and are compulsory..


2. Figures to the right indicate maximum marks for a question

1.A. Attempt any two sub-question from (a), (b) and (c) in MS-EXCEL (True of False) (2t
a) Worksheets can be linked with each other only if they are in different workbook.
b) The legend on a chart can be removed.
c) Solver and goal seek are used for the same purpose in Excel.
B. Attempt any two sub-question from (d) (e), (0 in VISUAL BASIC (Multiple Choice) (2)
d) _ is an event driven language.
A.C B.C+
C. BASIC D. VISUAL BASIC
e) The standard prefix for Command button is
A. comd B. cmd
C. com D. cbo
0 is a part of Visual Basic IDE.
A. Code window B. Properties window
-C. Project Explorrer window D. All of the above.
C. Attempt any six sub-questions from (g), (h), (i), CI), (m), (n), (o) in E-Commerce. (True or False)
(6)
g) In the subscription model a fee is charged to the user for having access to material on the website.
h) E-Market, EDI and Interest are parts of E-Commerce.
i) The volume of B2B transactions being done is more than B2C transactions.
j) Banners and sponsorships are examples ofsubscription revenue model.
k) Authenticity refers to the ability to determine the orgin of the message received over the intemet.
1) Encryption covers all the security issues.
m) Digital signature changes for every document.
n) In SSL the URL changes to HTTPs from HTTP.
o) Digital cash is the electronic parallel of notes and coins.
D. Attempt any five sub-question from (p), (q), (r), (s)' (t) (u) (v) (w) in E- Commerce. (Multiple
Choice) (5)
p) segment of E--commerce focuses consumers dealing with each other.
a) B2B b) C2B
-c) C2C d) B2C
q) Buying and selling products on the internet is called --.
a) EDI b) E-Commerce
c) E-Business d) E-market
r) E-trailer model is revenue model.
a) Sales b) SubcriPtion
c) Advertising - d) Affiliate
s) The sender and receiver will have the same key in Key encryption'
a) Symmetric b) AsYmmetric
c) Public d) Private
-
0 means converting cipher text to plain text.
a) Encryption b) DecryPtion
c)
- Conversion d) De-conversion
u) The full form of WAP in E-Commerce is Wireless Protocol'
a) And b) APP
c) Application d) Area-

I
268 3ioat'tf Computer Systems and Applications- T.Y.B.Com-(Sem. VI)

v) Ebay.com is _
a) onlyB2B b)
onlY C2C
c) onlyB2C d)
both B2B and B2C
w) When you make a payment using PayPal, you have to e-mail the payment to merchant's
account.
a) Current b) Saving -
c) PayPal d) None ofthese
2.A. Answer any one sub-question from (a) and (b) in E- Commerce. (8)
a) Explain the features of E-Commerce.
b) Explain the following B2C models in E-Commerce.
i) E-Tailer iD Content Provider
iii) Tansaction Broker iv) Market Creator
B. Answer any one sub-question from (c) and (d) in E-Commerce. (7)
c)
Discuss the various security issues in E-Commerce
d)
Explain how an Online Credit Card Transaction Works?
3.A. Answer any one sub-question from (a) and (b) in MS-EXCEL. (8)
Consider the worksheet
A B C D E
I NAME CITY SALES COMMISSION BONUS
2. RAHUL MUMBAI 80000
J ANJALI PUNE 100000
4. POOJA BANGLORE 50000
5. RAJ HYDERBAD 95000
6. KAJOL PLINE 200000
7. ADITYA BANGLORE 300000
8. SEEMA HYDERBAD 40000
Write Steps to perform the following:
i) To compute Commission @8% of sales whenever sales are below.
75,000 otherwise @ l0% of Sales in column D.
ii) To compute the Bonus as 2o/o of the Sales for Sales up to { 50,000 otherwise @ 5% of Sales in
column E.
The data has been entered in a worksheet.
A B C D E F G
l. NAME TESTl TEST2 TEST3 TEST4 AVERAGE GRADE
MARKS
2 SAMIRA 66 77 70 70
J SAIRA 56 67 72 77
4. NASIR 45 54 55 60
5 NITIN 40 45 48 56
6 SARITA 67 78 80 85
7 ADIL 65 66 69 78

Where Testl, Test2, Test3 and Test 4 are marks scored by the candidates in 4 tests.
Write steps to :

i) Find the Average marks in column F.


ii Assign Grade in Column G the
Average Marks Grade
80 or more 0
60 or more but below 80 A
Less than 60 B
Mumbai University Question Paper (December 2017) *Ct 269

3.B. Answer any one sub-question from (c) and (d) in MS-EXCEL. (7)
c) The data has been entered in a worksheet.
A B C D E F G H
I NAME DESIGNATION HRA DA DESIGNATION HRA DA
2. SONU PEON PEON 4000 5000
J. PINKY CLERK CLERK 8000 10000
4. RINKU CLERK MANAGER 15000 20000
5. SOPHIE MANAGER
6. PREM PEON
,l
BINDU CLERK
8. TINA MANAGER
Write steps to find the HRA and DA in column C and D respectively using VLOOKUP function. Policy
table to be referred for finding the HRA and DA is given in the range F2:H4.
Consider the worksheet
A B C D
1 NAME MONTHLY SALARY ANNUAL INCOME INCOME TAX
2. RAHUL 80000
J ANJALI 100000
4. POOJA 50000
5 RAJ 65000
6. KAJOL 40000
7 ADITYA 125000
8. SEEMA 40000
Write steps to calculate Annual Income in column C and Income Tax in column D where Income -Tax
is calcaluted as follows.
Taxable Annual Income Rate
First 1,00,000 Nil
Next 2,00,000 t0%
Excess 20o/n

4.A. Answer any one sub-question from (a) and (b) in MS-EXCEL (8)
a) The following data is entered in a worksheet regarding expenses (in {) during January, Feburary,
March and
A B C D E
1 ITEM JAN FEB MARCH APRIL
2. EDUCATION 6000 6000 6000 6000
J FOOD 15000 16000 17000 r 6000
4 RENT 4s000 45000 4s000 45000
5 CAR 12000 I 5000 I 3000 14000
6. TOTAL
Write steps to do the following :-
i) Find the total expenses in each month in the cells B6, C6, D6 and E6.
ii) Create 3-D Bar chart for expenses of January, February, March and April.
iii) Create a Pie chart for the month of March.
iv). Create a Line diagram for the months Febuary and April.
b) The following table shows Quantity, Unit Price, Income and total Income of a shopkeeper who sells
rice, dal, and tea.
A B C D E

I ITEM QUANTITY PRICE INCOME


2 RICE 100 80 8000
J DAL 50 r20 6000
4. SUGAR 60 70 4200
5 TEA 45 2s0 11250
Write steps to find Total Income in D6.
270 f1j,1f. Computer Systems andAppliiations-T.Y.B.Con'{Sen. VI)

Write steps in Excel using Solver to find how much quanlty of rice, dal, sugar and tea should be sold in
order to achieve total income of '50,000, assuming that quanity should be integer only.
4.B. Answer any one sub-question from (c), (d) in MS-EXCEL. (7)
c) The data has been entered in a worksheet.
A B C D
I EMPNO NAME SALARY INCOME TAX
2. E00l DOLLY 35000
3. E002 ANJALI 55000
4. E003 DIPALI 42000
5. E004 RAJ 50000
6. E005 KAJOL 52000
7 E006 ADITYA 75000
8. E007 REEMA 60000
Write steps to do the following :-
i) Display only those rows where the Salary is more than { 50,000.
iD Display only those rows where the Salary is more than ( 45000 but less than { 65,000.
iii) Display only those rows where name do not start with "M".
d) Explain the.following functions in MS-EXCEL.
l. ToDAY0 2. COTNTBLANKo
3. SMALL 0 4. YEAR 0
s. coRREL0 6. WEEKDAY0
7. DAY0
5.A. Answer any one sub-question from (a) and (b) tn VISUAL BASIC. (8)
a) Write a project in VB to accept students name and marts in Accounts, Economics and MHRM.
Calculate and display total mark and percentage.
b) Write a project in VB to design a suitable form which allows a user to enter three number in text
boxes. Find and display tle maximum number among them.
5.B. Answer any one subquestion from (c) and (d) in VISUAL BASIC. (7)
c) Write a project to design a suitable form to allow the user to enter name of salesperson and the total
sales. Calculate and display tlre commission earned by the salesperson based on the following table.
Use controls.
Total Sales (() Commission
Less than or equal to 90,000 Nil
Between 90,000 and up to 1,50,000 t0%
More than 1,50,000 t2%
d) Write a project in VB to compute and display the sum of the series 2 +5 +8+ 11+ ...+ 32.

ffli
Mumbai University Question Paper. (March 2018) flrlf 271

MUMBN UNIVERSITY QUESTION PAPER


MARCH-2018
Time Allowed. z 2'/2.Hours Total Marks : 75

N.B:1. All questions carry equal marks and are compulsory.


) tr'igures to the right indicate maximum marks for a question.

1.A. Attempt any two sub-questions from (a), (b) and (c) in MS-EXCEL. (True or False) {2)
a) The size ofchart can be changed.
b) A template has the file name extension .XLTX.
c) A workbook can contain maximum three worksheets.
B. Attempt any two sub-questions from (d), (e) and (f) in VISUAL BASIC. (Multiple Choice) (2)
d) In a VB project, the form design is carried out in the
l. properties 2. Tools Box
3. Project Explorer 4. Form Window
e) Visual Basic controls are _.
l. code 2. Part ofmenus
3. rules 4. Objects
0 is a valid object name for a text box.
l. TxtClass 2. Txt Class
3. Txt+class 4. TextClass
C. Attempt any six sub-questions from (g), (h), (i), (i), (k), (t), (m), (n), (o) in E-Commerce. (True or
False) (6)
g) Traditional commerce is more reliable than E-Commerce.
h) Non-repudiation refers to non-denial of E-Commerce transactions.
i) Portals eam revenue from advertising and referral fees.
j) Encryption is a process of converting cipher text to plain text.
k) Intergrity in E-Commerce ensures that data is not altered during transmission.
D In E-Commerce only credit cards can be used for making payments.
m) In public Key encryption there is only one key.
n) Hacking of credit cards and password is possible in E-Commerce.
o) Digital cash is the electronic parallel of notes and coins.
D. Attempt any live sub-questions from (p), (q), (r), (s), (t), (u), (v) (w), in E-Commerce. (Multiple
Choice) (6)
p) A Computer to Computer exchange of business transaction is called
A. E-Buisness B. Super Market
C. EDI D. E-Market
q) In _ E-Commerce the consumers deals with each other.
A. C2C B. B2C
C. B2B D. C2B
r) It is convention that all sites ihat uses SSL connection while making a secure connection use
instead of HTTP.
A. SMTP B. HTTPS -
B. FTP D. TCP/IP
s) The most commonly used form of payment in E-Commerce is _..
A. Credit Card B. PayPal
C. Petro Card D. Digital Cash
t) In online stored value systems, cards that have embedded chips that store personal information is
called _.
A. Debit Card B. Smart Card
C. Credit Card D. Ideal card
u) The full form of WAP in E-Commerce is Wireless _ Protocol.
A. And B. App
C. Application D. Area
272 tr"9"r' Computer Systems and Applications- T.Y.B.Com.-(Sem. VI)

v) The full form of HTTP in E-Commerce is Hlper Text _ Protocol.


A. Travel B. Topology
C. Transmit D. Transfer
w) The ful1 form of P2P in E-Commerce is _.
A. PeertoPeer B. PersontoPerson
C . Peer to Person D. Person to Peer
2.4. Answer any one sub-question from (a) and (b), in E-Commerce. (8)
a)
Explain the features of E-Commerce.
b)
Explain any four Revenue models in E-commerce.
B. Answer any one sub-question from (c) and (d) in E-Commerce . (7)
c) Explain any four advantages of E-Commerce.
d) Explain SET protocol
3.A. Answer any one sub-question from (a) and (b) in MS-EXCEL. (8)
Consider the worksheet.
A B C D E
1 NAME DEPARTMENT SALARY DA HRA
2. SI-INITA IT 85000
3. BINA SALES 7s000
4. PRAKASH ACCOUNTS 50000
5. JAY HR 6s000
6. NITIN SALES 35000
7 REENA ACCOUNTS 28000
Write steps to obtain
i) DA as l25o/o of the Basic if Basic is more than 40,000 otherwise 1 10% of the Basic in column
D.
ii) HRA. as 24oh of the Basic whenever Basic is below 30,000 otherwise 20Yo of the Basic in
column E.
iii)Find number of cells where the Department is 'SALES' in cell Cl0.
b) The data has been entered in a worksheet.
A B C D
I NAME SALES AMOUNT DISCOUNT NET PRICE
2. SAMIIRA 50000
J SAIRA 60000
4. NASIR 20000
5. NITIN 30000
6. SARITA 100000
7 ADIL 75000
Write steps to
i) Calculate Discount in column C the Discount
Sales Amount Rate of Discount
First 25,000 6%
Next 25,000 9%
ExceSs t2%
ii)Calculate Net Price in column D
(Net Price= Sales Amount-Discount)
B. Answer any one sub-question from (c) and (d) in MS-EXCEL. (7)
c The data has been entered in a worksheet.
A B C D E F G
I PRODUCT QUANITITY PRICE TOTAL COST PRODUCT PRICE
2 oI I LUX 45
J. KITKAT 4 DOVE 50
4. TEA I PEARS 44
Vumbai University Question Paper. (March 2018) Sr'tt' 273

5 SUGAR 2 HAMAM 25
6. PEARS 5 DETTOL 35
7 NESCAFE 6 LIRIL 40
8. KITKAT 20
9 NESCAFE 78
10. TEA 110
ll SUGAR 60
12. I
oIL 125
Write steps to find the Price in column C using VLOOKUP function. Table to be refened for finding
.he Price per unit is given in the range F2:G12. Also find Cost in Column D. (Total Cost: Price* Quanity)
Consider the worksheet.
A B C D E F
I ROLL NO. TESTI TEST2 TEST3 AVERAGE RESULT
2 1^44 56 49 55
J 454 76 87 65
4. A58 74 70 70
5 A60 87 54 67
6. AI 35 40 36
Write steps to
i) Calculate Average marks in column E.
ii) Find the result in Column F, where result is "Pass" when Average marks are 40 or
more otherwise "Fail".
iii) Find number of students whose Average marks are more than or equal to 70 in cell E8.
\. Answer any one sub-question from (a) and (b) in MS-EXCEL. (8)
a) The following data is entered in a worksheet regarding the stocks during January, February and
March.
A B C D E
I ITEM JAN FEB MAR TOTAL
2. PENCIL 4000 4200 4500
3. PEN 3000 3000 3100
4. NOTE BOOK 2000 I 800 1800
5. WRITING PAD 1000 l 100 1200
Write steps to
i) Find the total stock of each product in the cells E2,F.3, E4 and E5.
ii) Create 3-D Bar chart for the data.
iii) Create a Pie chart for the month of March.
iv) Create a Line diagram for Jan and March.
b) The following table shows Quantity, Cost Price per unit (CPRICE) and Selling Price per unit

A B C D E F G
1 PRODUCT QTY CPRICE SPRICE COST SALES PROFIT
2. PRODUCT I 200 100 t23
J PRODUCT 2 240 75 r20
4. PRODUCT 3 430 28 60
5. PRODUCT 4 t20 45 70
6. PRODUCT 5 320 40 55
7 PRODUCT 6 230 50 65
8 PRODUCT 7 250 65 80
Write steps in Excel to calculate Cost in column E, Sales in column F, Profit in column G and Total
rofit in G9 respectively. Write steps in Excel using Solver to find what the cost per unit should be in order to
;hieve the Total Profit of 75,000.
'coST=QTY'ICPzuCE
274 fdt/ Computer Systems and Applications- T.Y.B.Com.-(Sem.

toLg5=QTY*SPNCE
PROFIT=SALES-COST)
4.B. Answer any one sub-question from (c) and (d) in MS-EXCEL.
The data has been entered in a worksheet.
A B C D
I sNo NAME CITY SALESAMOUNT
2. s00l AJAY MUMBAI 3s000
J. s002 POOJA PUNE 55000
4. s003 AJIT MUMBAI 42000
5. s004 JAY BANGALORE s0000
6. s005 RITA PUNE 52000
7 s006 SAMIR MUMBAI 75000
8. s007 NEHA BANGALORE 60000
Write steps to do the following :-
D Display only those rows where the City is Bangalore'.
iD Display only those rows where Sales Amount is below average Sales Amount.
iii) Display only those rows where the Sales Amount is more than 48,000 but less than 70,000.
d) Explain the following functions in MS-EXCEL.
r. DATE0 2. COLTNTBLANKO
3. LARGE0 4. NOWo
5. SMALL 0 6. MONTH 0
7. WEEKDAYO
5.A. Answer any one sub-question from (a) and (b) in VISUAL BASIC.
a) Write a project in VB to design a suitable form which allows the user to enter a number i
calculate and display whether the number is divisible by 7 or not.
b) Write a project in VB to design a suitable form which allows the user to enter Name and i
Salary and calculate Bonus as 45% of Basic Salary whenever basic salary is less than 25
otherwise 40% of Basic Salary using a'Calculate button and display the result.
5.B. Answer any one sub-question from (c) and (d) in YISUAL BASIC
c) Write a project in VB to design a suitable form which allows the user to enter length of a side ,
square and then calculate and display area and perimeter ofthe square.
(Area=Side*Side)
Perimeter4*Side)
d) Write a project in VB to design a suitable form which allows the user to enter an integer a
calculate and display the factorial of that integer when the "Calculate" button is clicked.
(Factorial of N+l *2*3*............*N)

rfrff

r\q?''\q9
Yffit&\
0ur Outstanding Puhlications for
T.Y.B.Gom. Semester' Vl
DISCIPLINE RELATED ELECTM (DRE) COURSES
HUMAN RESOURSE IJIANAGEMENT (Commerce-Vl)
A1aga,:t'V.a, o?'..2'
OBJECTIVE QUESTION FOR HUMAN RESOURSE MANAGEMENT
Ajagaonkar Patxar
BUSINESS ECONOMICS
Kalkoti. Rajalaksnm,;
BUSINESS ECONOMICS
Ivlithani Sayyeo
tqifr 3rrft gq6ul
rsi'r, qra-ror, sr}6q
.or.rerkO Oefqrrg
3{rqrd-fi-{
DrscpLrNE spEcIFIc ELECTM COURSE (DSE1 '..
FINANC|AL ACCOUNTlNG
i)hopde & others
COST ACCOUNTING
l''.tde & others
MANAGEMENT & ORGANTSATTON DEVELOPMENT (8,M.-t)

f{qurq svt}crc
lTa{fi{
qasrq laqr
?srd, q1w
ABI LITY E NHANCEMENT COURSES €ffi} n
DIRECT AND INDIRECT TAXATION - (Paper.ll} GST
Singavi & others
EXPORT MARKETING
Joshi
COMPUTER SYSTEM & APPLICATIONS
Gadiwalla. Tekwani
MARKETING RESEARCH .1I
Nerurkar. Joshi. Kalkoti. Tripathi. Dalvi
Mo frqurc

it"
PVT. tTD.
ISBN - 978-E1-936595-s_7
unit N0.4. Ground Floor Lalwani lndustrial Estate. i4.G.D. Ambekar Marg, wadala. Mumbai.400 03
rel.:Jc22i 6662 45s3. 6662 4554. Fax: 6662 4556. e.mairr [email protected]

ill]illtffiililIilI]lIilt
Follow ur, /sherhpuhtishers
ffi ffi trr,.il,.pubtishers
Price - { 220.00

You might also like