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

CBA Excel 11 Text Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

CBA Excel 11 Text Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Text Functions

Lecture 11

CBA
TEXT DATA

2
TEXT / STRING / CHARACTER
The following three terms all used to refer to "text" data. All three terms
mean the same thing.

– text data
– string data
– character data

This presentation will generally use the term "text data" but you should
be familiar with the terms "string data" and "character data"

3
TEXT DATA

Text data is used to store general purpose text (e.g. names,


places, descriptions, etc)

You can't do "math" with text values (obviously)

4
TEXT ISN'T PART OF NUMERICAL CALCULATIONS
(OBVIOUSLY)
Formula to formula view (press Cntrl-`)
add up all
numbers in
column C

(Same
Spreadsheet)
values view (press Cntrl-`)
Text data in
C1 is not
included in the
Sum
5
TEXT FUNCTIONS

6
TEXT FUNCTIONS
Many functions are used to manipulate text values.
The following are only some of them

right( ) Trim ()
left( ) Choose ()
mid( ) Substitute()
concatenate( )
lower( )
upper( )
len( )
7
RIGHT, LEFT AND MID FUNCTIONS

8
RIGHT FUNCTION

The RIGHT function is used to isolate a specific number of


“characters” from the right hand side of a text value.

(example on next slide)

9
RIGHT ( <TEXT>,
<NUMCHARACTERS>)
Formula View

Values View

10
RIGHT – NUMCHARACTERS IS
OPTIONAL
The <numCharacters> parameter in the RIGHT function is optional. If you don’t specify it the default is 1 (one).

Formula View

These produce the


same results.
Values View

11
LEFT

The LEFT function is the same as the RIGHT function, but it


returns characters from the LEFT side of the value.

12
MID ( <TEXT>, <STARTPOSITION> ,
<NUMCHARACTERS>)
MID is used to get values from the middle of some text.

MID takes 3 parameters:

– The original text


– The position to start taking the new value from
– The number of characters to take for the new value

Example on next slide

13
EXAMPLE: MID ( <TEXT>, <STARTPOSITION> ,
<NUMCHARACTERS>)
This example extracts the second through the fourth
characters from the original text value:
Formula View

Values View

14
TRIM FUNCTION
• Removes all spaces from text except for single spaces between words. Use TRIM on text that you
have received from another application that may have irregular spacing.
• TRIM strips extra spaces from text, leaving only single spaces between words and no space
characters at the start or end of the text.
• TRIM is useful when cleaning up text that has come from other applications or environments.

Syntax: The syntax for the TRIM function in Microsoft Excel is: TRIM( text )

Parameters or Arguments: text (The text value to remove the leading and trailing spaces from.)

Returns: The TRIM function returns a string/text value


TRIM FUNCTION EXAMPLES
FIND FUNCTION
The Excel FIND function returns the position (as a number)
of one text string inside another. When the
• The FIND function will return the location
text is not found, FIND returns a #VALUE error.
of the first instance of find_text in
Purpose : Get the location of text in a string within_text.
Return value: A number representing the location of
• The location is returned as the number of
find_text.
Syntax: =FIND (find_text, within_text, [start_num]) characters from the start of within_text.
Arguments: • Start_num is optional and defaults to 1.
find_text - The text to find.
• FIND will return #VALUE if find_text is not
within_text - The text to search within.
start_num - [optional] The starting position in the text to found in within_text .
search. Optional, defaults to 1. • FIND is case-sensitive
SEARCH FUNCTION
 Summary
 The Excel SEARCH function returns the location of one text string inside another. SEARCH returns the
position of the first character of find_text inside within_text. Unlike FIND, SEARCH allows wildcards,
and is not case-sensitive.

 Purpose
 Get the location of text in a string

 Return value
 A number representing the location of find_text.

 Syntax
 =SEARCH (find_text, within_text, [start_num])
USAGE NOTES
 Use the SEARCH function to get the location of one text string inside another.
 SEARCH returns the position of the first character of find_text inside within_text.
 Unlike FIND, SEARCH allows the use of wildcards, and is not case-sensitive.
 SEARCH allows the wildcard characters question mark (?) and asterisk (*), in
find_text.
 The ? matches any single character and the * matches any sequence of characters.
 To find a literal ? or *, use a tilde (~) before the character, i.e. ~* and ~?.
CONCATENATION
( & ) AND
CONCATENATE FUNCTION

21
CONCATENATION (&)
Use & to combine (or concatenate) two different text values

Formula View

Values View

Notice that there is no


space between the two
22
values
CONCATENATE MANY VALUES
You may concatenate many values together

Formula View

Values View

23
CONCATENATION WITH "LITERAL"
VALUES
You can also concatenate "literal" values.
You must include the literal values inside quotes
For example to display spaces in the "full name" in the previous example
you could use the following formula. Each space that you want to
display must be included in quotes.

=A2&" "&B2&" "&C2


(Don't forget any of the &'s )
See next slide ...

24
CONCATENATING SPACES - EXAMPLE
You can concatenate spaces into a formula

Formula View

Values View values


contain
spaces

25
LEFT( ) WITH & IN SAME FORMULA
You can combine the results of different function calls with concatenation.

Formula View

Values View

26
PUTTING IT ALL TOGETHER
In this example we concatenate periods into the initials.

Formula View

Values View

The initials now contain


periods
27
CONCATENATE FUNCTION
You can use the CONCATENATE function instead of the ampersand (&).
The following formulas are equivalent:

=A1&B1&C1

=CONCATENATE(A1,B1,C1)

The CONCATENATE function can take as many parameters as you like.

28
MORE TEXT FUNCTIONS:
LOWER
UPPER
LEN

29
LOWER ( <TEXTVALUE> )
UPPER ( <TEXTVALUE> )
LOWER converts text to lower case.
UPPER converts text to upper case.
Example:

Formula View

Values View

30
LEN ( <TEXTVALUE> )
LEN returns a numeric value equal to the number of character in a text value (i.e. the “length” of the
text value).
Spaces ARE included in the length.
Example

Formula View

Values View 31
EXCEL SUBSTITUTE FUNCTION
Summary
The Excel SUBSTITUTE function replaces text in a given string by matching. For example
=SUBSTITUTE("952-455-7865","-","") returns "9524557865"; the dash is
stripped. SUBSTITUTE is case-sensitive and does not support wildcards.

Purpose
Replace text based on content

Return value
The altered text.
EXCEL SUBSTITUTE FUNCTION
Syntax
=SUBSTITUTE (text, old_text, new_text, [instance])
Arguments
text - The text to change.
old_text - The text to replace.
new_text - The text to replace with.
instance - [optional] The instance of old_text to replace
with new_text. Optional; if not supplied, all
instances of old_text are replaced with new_text.

Summary
The Excel SUBSTITUTE function replaces text in a given string by matching. For
example =SUBSTITUTE("952-455-7865","-","") returns "9524557865"; the dash is
stripped. SUBSTITUTE is case-sensitive
CONVERTING NUMERIC VALUE'S INTO
WORDS
=CHOOSE(C6,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten")&"Taka"

34
TEXT TO COLUMNS
Step 1
Step 1 : Select the range with full names.
Step 2 : On the Data tab,
in the Data Tools group, click Text to Columns.
Step 2
STEP 3 : CHOOSE DELIMITED AND
CLICK NEXT.
STEP 4 : 4. CLEAR ALL THE CHECK BOXES UNDER DELIMITERS
EXCEPT FOR THE COMMA AND SPACE CHECK BOX.
STEP 5 : CLICK FINISH.

Note: This example has


commas and spaces as
delimiters. You may have
other delimiters in your
data. Experiment by
checking and unchecking
the different check boxes.
You get a live preview of
how your data will be
separated.
RESULT
DIFF TYPES OF FLASH FILL

You might also like