Вы находитесь на странице: 1из 14

Information Systems and MS Excel

Dr Y L P Thorani
WORKING WITH
FUNCTIONS
 A Function is a predefined worksheet
formula
 Benefits of predefined functions
 Saves time
 Simplifies complex calculations
 Faster execution
 Less chance of typographical errors
 Fewer characters in the formula bar
 The general format of a function is -
=Functionname(arguments)
Example: =PMT(rate, nper, pv, [fv], [type])
 Arguments

 argument variables are used by the function to


calculate the result.
 Arguments appear in a specific order.
 Example: rate, nper, pv, [fv], [type] are all
arguments in that order
 Syntax
 The syntax specifies the order in which you must enter
the different parts of the function and the location in
which you must insert commas, parentheses, and other
punctuation
 Example:
PMT(rate, nper, pv, [fv], [type]). This is the syntax for
PMT function. In this function,[fv ]and [type ]are
taken by default, whereas other arguments are
necessary to execute the function.
 Result – the value calculated by the function
 Excel supplies more than 350 functions
organized into different categories:
◦ Database, Date and Time, Engineering, Financial,
Information, Logical, Lookup, Math, Text and Data, and
Statistical functions
 You can use the Insert Function button on the
Formula bar to select from a list of functions.
 A series of dialog boxes will assist you in filling
in the arguments of the function and this process
also enforces the use of proper syntax.
 We don’t have to restrict ourselves to these (user
defined) functions. We can also create our own
functions (called “custom functions”) with VBA
programming.
 LEFT  CONCATENATE
 RIGHT  REPLACE

 MID  VALUE

 TRIM  UPPER
 LOWER
 LEN
 PROPER
 FIND
 CHAR
 SEARCH
 CLEAN
 REPT
 SUBSTITUTE
The LEFT function
The LEFT(text,k) function returns the first k characters in a text
string. For example, cell C3 contains the LEFT(A3,4) formula. Excel
returns Regg.
The RIGHT function
The RIGHT(text,k) function returns the last k characters in a text
string. For example, in cell C4, the RIGHT(A3,4) formula returns
ller.
The MID function
The MID(text,k,m) function begins at character k of a text string and
returns the next m characters. For example, the MID(A3,2,5) formula
in cell C8 returns characters 2–6 from cell A3; the result is eggie.
The TRIM function
The TRIM(text) function removes all spaces from a text string except for
single spaces between words. For example, in cell C5, the TRIM(A3)
formula eliminates two of the three spaces between Reggie and Miller
and yields Reggie Miller. The TRIM function also removes spaces at the
beginning and end of a cell’s contents.

The FIND and SEARCH functions


The FIND(text to find, actual text,k) function returns the location at or
after character k of the first character of text to find in actual text.
FIND is case sensitive. SEARCH has the same syntax as FIND, but it is
not case sensitive. For example, the FIND(“r”,A3,1) formula in cell C10
returns 15, the location of the first lowercase r in the Reggie Miller text
string. (The uppercase R is ignored because FIND is case sensitive.)
The REPT function
You can use the REPT function to repeat a text string a specified
number of times. The syntax is REPT(text,number_of_times). For
example REPT(“|”,3) produces output |||.
The CONCATENATE and & functions
The CONCATENATE(text1,text2, . . .,text30) function can be used to join
up to 30 text strings into a single string. The & operator can be used
instead of CONCATENATE. For example, entering the A1&” “&B1 formula
in cell C12 returns Reggie Miller. Entering the CONCATENATE(A1,” “,B1)
formula in cell D12 yields the same result.
The REPLACE function
The REPLACE(old_text,k,m,new_text) function begins at character k of
old text and replaces the next m characters with new text. For
example, in cell C13, the REPLACE(A3,3,2,”nn”) formula replaces the
third and fourth characters (gg) in cell A3 with nn. This formula yields
Rennie Miller.
The UPPER, LOWER, and PROPER functions
The UPPER(text) function changes text to all uppercase. For example, in
cell C16, the LOWER(C12) formula changes the capital letters to small and
yields reggie miller. In cell C17, the UPPER(C16) formula changes all
letters to uppercase and yields REGGIE MILLER. Finally, in cell C18, the
PROPER(C17) formula restores the proper case and yields Reggie Miller.

The SUBSTITUTE FUNCTION


The SUBSTITUTE function replaces specific text in a cell when you do
not know the position of the text. The syntax of the SUBSTITUTE
function is SUBSTITUTE(cell,old_text,new_text,[instance_number]). The
last argument is optional. If omitted, every occurrence of old text in the
cell is replaced by new text. If the last argument is included (say with a
value of n), only the nth instance of old text is replaced by new text. To
illustrate the use of the SUBSTITUTE function, suppose you want to
replace the spaces in cell C17 with asterisks. First, you enter the
SUBSTITUTE(D17,” “,”*”) formula in cell C19.
 I have a worksheet in which each cell
contains a product description, a product
ID, and a product price. How can I put all
the product descriptions in column A, all
the product IDs in column B, and all the
prices in column C?
 Every day, I receive data about total US sales,
which is computed in a cell as the sum of
East, North, and South regional sales. How
can I extract East, North, and South sales to
separate cells?

Вам также может понравиться