SlideShare a Scribd company logo
1 of 20
Download to read offline
ACLM Institute of Professional Studies | 1
Working with Text Functions
Working with
Text Functions
in
MS-Excel
Designed for Microsoft Office specialist (MOS) Exam
- Kumar Amit -
ACLM Institute of Professional Studies | 2
MS Excel : Chapter 3
ACLM Institute of Professional Studies | 3
Working with Text Functions
15CHAPTER
In this chapter
Text Functions
In this chapter
Text Functions Overview 326
CONCATENATE 328
EXACT 329
FIND 330
FIXED 331
LEN 332
LOWER 333
MID 334
PROPER 335
RIGHT 336
Add st, nd, rd, and th to the End of Numbers 337
SUBSTITUTE 338
TRIM 339
UPPER 340
19 0789729539 CH15 8/21/03 4:41 PM Page 325
ACLM Institute of Professional Studies | 4
MS Excel : Chapter 3
326 Chapter 15 Text Functions
Text Functions Overview
Text functions can be used in several ways. They can return the number of characters in text
strings, remove extra spaces and nonprintable characters from cells, return exact data within
a string, change the case of text strings, and even combine text from other cells. If you
inherit workbooks from other people, you will eventually have to clean up or manipulate the
data. Text functions allow you to create consistency throughout the workbook. Because cer-
tain functions are case sensitive, it’s good practice to create consistency throughout lists and
tables. This chapter covers the functions in Table 15.1 that are marked in bold.
Table 15.1 Text Functions
Function Syntax Description
CHAR =CHAR(number) Returns the character specified by a number.
CLEAN =CLEAN(text) Removes all nonprintable characters from
text.
CODE =CODE(text) Returns a numeric code for the first
character in a text string.
CONCATENATE =CONCATENATE(text1,text2,...) Joins several text strings into one text string.
DOLLAR =DOLLAR(number,decimals) Converts a number to text using currency
format, with the decimals rounded to the
specified place.
EXACT =EXACT(text1,text2) Compares two text strings and returns
TRUE if they’re exactly the same, and
FALSE otherwise.
FIND =FIND(find_text,within_text, Finds one text string within another text
start_num) string, andreturns the number of the
starting position of find_text, from the
leftmost character of within_text.
FIXED =FIXED(number,decimals, Rounds a number to a specified number of
no_commas) decimals, formats the number in decimal
format using a period and commas, and
returns the result as text.
LEFT =LEFT(text,num_char) Returns the first character or characters in a
text string based on the number of characters
you specify.
LEN =LEN(text) Returns the number of characters in a text
string.
LOWER =LOWER(text) Converts all uppercase letters in a text string
to lowercase.
15
19 0789729539 CH15 8/21/03 4:41 PM Page 326
ACLM Institute of Professional Studies | 5
Working with Text Functions
327Text Functions Overview
MID =MID(text,start_num,num_char) Returns a specific number of characters from
a text string, starting at the position you
specify.
PROPER =PROPER(text) Capitalizes the first letter of each word in a
text string and any other letters in text that
follow any character other than a letter.
REPLACE =REPLACE(old_text,start_num, Replaces a portion of a text string with a
num_chars,new_text) different text string based on the number of
characters you specify.
REPLACEB =REPLACEB(old_text,start_num, Replaces part of a text string with a
num_bytes,new_text) different text string based on the number of
bytes you specify.
REPT =REPT(text,number_times) Repeats text a given number of times.
RIGHT =RIGHT(text,num_chars) Returns the last character or characters in a
text string based on the number of characters
you specify.
SEARCH =SEARCH(find_text, Returns the number of the character at
within_text, start_num) which a specific character or text string is
first found, reading from left to right.
SEARCH is not case sensitive and can include
wildcard characters.
SEARCHB =SEARCHB(find_text, Returns the number of the character at
within_text,start_num) which a specific haracter or text string is
first found, based on its byte position,
reading from left to right.
SUBSTITUTE =SUBSTITUTE(text,old_text, Substitutes new_text for old_text in a T
new_text,instance_num) text string. Returns the text referred to by
=T(value) value.
TEXT =TEXT(value,format_text) Converts a value to text in a specific number
format.
TRIM =TRIM(text) Removes all spaces from text except for
single spaces between words.
UPPER =UPPER(text) Converts text to uppercase.
VALUE =VALUE(text) Converts a text string that represents a
number to a number.
15
Function Syntax Description
19 0789729539 CH15 8/21/03 4:41 PM Page 327
ACLM Institute of Professional Studies | 6
MS Excel : Chapter 3
328 Chapter 15 Text Functions
CONCATENATE
The CONCATENATE function is one of the more useful functions you’ll find in Excel. CONCATE-
NATE can be used to join text in several forms. One reason it’s useful is when you inherit
spreadsheets from other creators you’ll often need to clean up the cells and text. Often, this
includes the combination of information within one cell and this is where concatenate
comes in.
=CONCATENATE(text1,text2,...)
Using this function by itself joins a city and state as shown in the first example in Fig-
ure 15.1; however, you also can place characters between the adjoined text by inserting them
within a pair of open and close quotation marks.
15
N O T E
If you adjoin numbers with the ampersand or the CONCATENATE function, the result is
converted to text.
The characters or text can include spacing, dashes, commas, numbers, other functions, and
so on. Notice some of the different ways the CONCATENATE function can join text in separate
cells. You can also use the ampersand (&). If you want to adjoin three or more cells with the
ampersand, it would appear as follows: =A1&B1&C1. If you want to separate the three cells
with a space, it would be =A1&” “&B1&” “&C1. Notice how each adjoined cell or text is sepa-
rated by the ampersand.
■ TEXT 1, TEXT 2...—Text is the text to be joined. You can join from 1 to 30 items
per cell.
Using & to connect strings does NOT have CONCATENATE’s 30-item limit.
T I P F R O M
19 0789729539 CH15 8/21/03 4:41 PM Page 328
ACLM Institute of Professional Studies | 7
Working with Text Functions
329EXACT
EXACT
EXACT compares two text strings and returns TRUE if they’re exactly the same, and FALSE
otherwise. EXACT is case sensitive.
=EXACT(text1,text2)
The EXACT function compares two text strings to see whether they are the same. The EXACT
function can operate from text within the function or via cell referencing. The EXACT func-
tion is case sensitive as shown in the following examples.
■ TEXT 1, TEXT 2...—The text is the first text string and then the second text string.
For example:
=EXACT(“BILL”,”bill”) results in FALSE.
=EXACT(“BILL”,”BILL”) results in TRUE.
As you see in Figure 15.2, there are two examples comparing ranges of cells with the EXACT
function. The first displays TRUE when an asset is complete using cell referencing. The
second compares a single cell reference to a range in the form of an array. If you had a list of
assets, and all assets had unique identities, you might want to determine whether the asset is
in the list. For this, you would use the EXACT function with the OR function in the form of an
array as shown here and in cell F16 of Figure 15.2. Be sure to activate the array by pressing
Ctrl+Shift+Enter.
ARRAY {=Or(Exact(Cell Reference, Compare Range))}
15
Figure 15.1
The CONCATE-
NATE function
allows you to join
text from separate
cells into the same
cell.
Ampersand joins text with next characters
Quotes allow for text insertion
19 0789729539 CH15 8/21/03 4:41 PM Page 329
ACLM Institute of Professional Studies | 8
MS Excel : Chapter 3
330 Chapter 15 Text Functions
FIND
FIND locates one text string with another text string and returns the number of the starting
position of find_text, from the leftmost character of within_text. The FIND function is case
sensitive.
=FIND(find_text,within_text,start_num)
■ FIND_TEXT—The find_text is the text you want to locate or find.
■ WITHIN TEXT—The within_text refers to the text string you’re looking within.
■ START NUM—The start_num refers to the number from left to right from which to start
looking for the text. For example, Patrick where the “t” character would be third as the
start_num.
For example:
=FIND(“W”,”Wally Bill”), where W is the first character in the string, results in 1.
=FIND(“a”,”Wally Bill”), where a is the second character in the string, results in 2.
15
Figure 15.2
The EXACT function
tests two sets of infor-
mation and displays a
logical value of TRUE
or FALSE depending
on whether the infor-
mation is equal.
...this cell...
Compares...
...with this cell
Looks up a cell against a range
N O T E
It’s important to note that FIND looks only for the first instance of the text it’s looking for.
If, for example, we were looking for “a” in, “Wally Ball,” the result would still be 2.
If you had a cell that contained the names of people and the cities and states they lived in,
you could combine the FIND function with the MID function to extract a text string. The MID
function is explained later in this chapter.
19 0789729539 CH15 8/21/03 4:41 PM Page 330
ACLM Institute of Professional Studies | 9
Working with Text Functions
331FIXED
In Figure 15.3, the formula =Mid(C6,1,Find(“ “,C6,1)-1) results in the extraction of the
first word, which in this case is a name in the cell, regardless of the length of the first name.
The MID function (covered later in this chapter) looks at cell C6 and starts with the first text
string; the FIND function also starts with cell C6 and looks for the first space as noted in the
quotation marks. The formula then takes the position of the space found and subtracts 1 to
return the result.
To take this explanation a step further, the formula =Mid(C6,1,Find(“ “,C6,1)-1) extracts
the first word from a string regardless of the length of the string. The FIND function looks
for a space in the text in cell C6 beginning at character 1. It finds this space at position 6.
Then 1 is deducted from this resulting in a formula which now evaluates to this:
=Mid(C6,1,5). The MID function (covered later in this chapter) now extracts a five-character
string from cell C6 beginning at character position 1.
15
Figure 15.3
The FIND function
combined with the
MID function can
extract text strings in
cells regardless of the
string length.
Subtracts the space
and returns the result
Finds the space
Looks for character
number in text string
FIXED
The FIXED function rounds a number to a specified number of decimals, formats the num-
ber in decimal format using a period and commas, and returns the result as text:
=FIXED(number,decimals,no_commas)
The FIXED function can round numbers in a cell. You can use the FIXED function with text in
the function or with cell referencing. Use the FIXED function to round numbers to decimals,
hundreds, and thousands. The examples in Figure 15.4 round a number to decimals, tens,
hundreds, and thousands using the FIXED function.
19 0789729539 CH15 8/21/03 4:41 PM Page 331
ACLM Institute of Professional Studies | 10
MS Excel : Chapter 3
332 Chapter 15 Text Functions
■ NUMBER—The number refers to the number you want to round or convert to text.
■ DECIMALS—The decimals refer to the number of decimal places to the right. If no deci-
mals are specified it assumes 2.
■ NO COMMAS—The no commas is a logical result in that if TRUE, it prevents the function
from including any commas in the text returned result. For example, the formula
=Fixed(2345.24,1,TRUE) would result in 2345.2 without commas.
15
N O T E
The difference between FIXED and ROUND is that FIXED returns its answer in the form
of text. FIXED results can be used only in other numeric calculations if converted back to
a number using the VALUE function.
Figure 15.4
Use the FIXED
function to round
numbers in a cell.
LEN
LEN returns the number of characters in a text string:
=LEN(text)
The LEN function on its own returns the number of characters in a text string. For example,
if you had the name Bob in cell A1 and you typed in cell B1 =LEN(A1) the result would be 3.
This is an extremely powerful tool when combined with other functions. See also, the
“RIGHT” function.
■ TEXT—The text refers to the text string, word, or multiple words that you want to find
the total number of characters. For example, the formula =LEN(“ Hello”) would result
in 5.
Because spaces also count as one character, =LEN(“Mn Albany”) would result in 9. While the
usefulness of this function may not seem clear, in reality, when combined with other
19 0789729539 CH15 8/21/03 4:41 PM Page 332
ACLM Institute of Professional Studies | 11
Working with Text Functions
333LOWER
functions in Excel, the LEN function becomes a powerful tool for extracting text strings. If
you work in an environment in which you have to clean workbooks that were set up
improperly, or you’ve inherited lists of information and have to extract text strings within
cells for your own particular purposes, use the LEN function in conjunction with other Excel
functions. In the example in Figure 15.5, say you wanted to extract the equipment brand
from the equipment type. The function =RIGHT(C17,LEN(C17)-FIND(“ “,C17)) results in
Caterpillar, because the function extracts the text to the right of the space. (See the “RIGHT”
section later in this chapter.)
15
Figure 15.5
Use LEN with other
functions in Excel for
text extraction.
Returns the result
Looks for a space
Counts characters in cell
Finds right-most character
LOWER
LOWER converts all letters in a text string to lowercase:
=LOWER(text)
The LOWER function is primarily a cleaning function. If you have inconsistent data in lists
and you want all characters to result in lowercase, use the LOWER function. In Figure 15.6,
the LOWER function converts all the uppercase names to lowercase. Use Paste Special and
paste as values back into the original location in the list after you’ve converted all charac-
ters to lowercase. This function can be used with text in a cell or with cell referencing as
demonstrated in the figure.
For more information on Paste Special See also Chapter 17, “Setting Up a List or
Database in Excel.”
■ TEXT—This is the text within the cell you want to convert to lowercase characters.
19 0789729539 CH15 8/21/03 4:41 PM Page 333
ACLM Institute of Professional Studies | 12
MS Excel : Chapter 3
334 Chapter 15 Text Functions
MID
Use the MID function to return a specific number of characters from a text string, starting at
the position you specify:
=MID(text,start_num,num_char)
■ TEXT—The text is the text string or word you want to extract from.
■ START_NUM—The start_num is the number of the character within the text string or
word you want to extract from.
■ NUM_CHAR—The num_char is the number of characters to extract from the start_num
point to the right.
You can use text within the formula or use cell referencing. For example, =MID(“Chris”,1,4)
returns only the first four characters in the string—Chri. =MID(“Hobbe”,2,4) returns the text
string starting with the second character in the string—obbe. Combined with the FIND func-
tion, you can create a powerful tool to dynamically extract any text within a string as shown
in Figure 15.7 and described in this section. If you have a URL and you want to extract the
actual name from a list of URLs and the name appears in different locations in each URL,
you could use the following formulas to do so.
In cell C6, the formula used to extract any text name from a URL is
=MID(B6,FIND(“Sports”,B6),6)
15
Figure 15.6
Use the LOWER func-
tion to clean lists of
information that are
inconsistent.
19 0789729539 CH15 8/21/03 4:41 PM Page 334
ACLM Institute of Professional Studies | 13
Working with Text Functions
335PROPER
To set up the same formula as shown here with cell referencing, see the formula in Fig-
ure 15.7 located in cell E17 and shown here. This will allow you to dynamically pull any text
string from a URL.
=IF(ISERROR(FIND(C17,B17)),””,MID(B17,FIND(C17,B17),D17))
PROPER
PROPER capitalizes the first letter of each word in a text string or sentence.
=PROPER(text)
The PROPER function is another cleaning tool function. It places initial caps on each word
within the text string specified in the formula, or text within a cell if you are using cell refer-
encing. The result of =PROPER(“PATRICK”) would be Patrick. Notice that the example in
Figure 15.8, used with cell referencing on lists, can quickly clean up the list.
■ TEXT—The text is the text in the text string, word, or sentence to convert to proper.
Meaning, the first character is capitalized in each word.
15
Figure 15.7
Use the MID function
as a standalone func-
tion or in combina-
tion with other
functions such as
FIND.
If the name doesn’t appear in the URL, it will return a #Value error. To eliminate this, use
the function found in cell C10 in Figure 15.7 and shown here:
=IF(ISERROR(FIND(“Sports”,B11)),””,MID(B11,FIND(“Sports”,B11),6))
19 0789729539 CH15 8/21/03 4:41 PM Page 335
ACLM Institute of Professional Studies | 14
MS Excel : Chapter 3
336 Chapter 15 Text Functions
RIGHT
RIGHT returns the last character or characters in a text string:
=RIGHT(text,num_chars)
The text can be in the form of text within the formula or as a cell reference. (Refer to the
“LEFT” section earlier in this chapter.) The NUM_CHARS argument is the number of characters
to return.
■ TEXT—This is the text string, word, or sentence you want to extract characters from.
■ NUM_CHARS—This indicates the number of characters you want to extract starting from
the right moving left.
For example, =RIGHT(“Patrick”,4) would return rick, as shown in Figure 15.9. When
including text within the formula, you need quotes. When you use cell referencing, you
don’t.
15
Figure 15.8
The PROPER func-
tion creates text with
initial caps.
19 0789729539 CH15 8/21/03 4:41 PM Page 336
ACLM Institute of Professional Studies | 15
Working with Text Functions
337Add st, nd, rd, and th to the End of Numbers
Add st, nd, rd, and th to the End of Numbers
You can use the IF, OR, VALUE, RIGHT, and CHOOSE functions together to create automated
ordinals, where an ordinal is an adjective used to describe the numerical position of an
object. In Figure 15.10, B7 contains the number 1. If your list of numbers begin in cell B7,
the formula would be
=B7&If(Or(Value(Right(B7,2))={11,12,13}),”th”,If(Or(Value(Right(B7))
➥={1,2,3}),Choose(Right(B7),”st”,”nd”,”rd”),”th”))
This code adds the following results to the end of ordinary numbers:
1st
2nd
3rd
4th
15
Figure 15.9
The RIGHT function
in conjunction with
the LEN and FIND
functions can be used
to extract the right-
most words.
Counts
characters
Starting at the right
Finds the space
19 0789729539 CH15 8/21/03 4:41 PM Page 337
ACLM Institute of Professional Studies | 16
MS Excel : Chapter 3
338 Chapter 15 Text Functions
SUBSTITUTE
The SUBSTITUTE function replaces old text within a text string with new text.
=SUBSTITUTE(text,old_text,new_text,instance_num)
The text can be in the formula or used as a cell reference. The examples in Figure 15.11
show the SUBSTITUTE function in the first example using complete cell referencing from one
cell to another. The second example gives a mix of cell referencing and text directly in the
formula. For the formula =SUBSTITUTE(“Melrose”,C11,”Farming”), where Cll equals
Melrose, the result is Farming.
■ TEXT—This is the text in a cell you want to substitute.
■ OLD_TEXT—This is the text you want to replace.
■ NEW_TEXT—This is the new text to replace the old text with.
■ INSTANCE_NUM—This is the number of instances you want to replace the old text with.
For example, if you want to replace every occurrence of old text, use “][“. If replacing
just one occurrence, use 1.
15
Adds ordinals to ordinary numbers
Figure 15.10
You can add ordinals
to the end of num-
bers automatically.
19 0789729539 CH15 8/21/03 4:41 PM Page 338
ACLM Institute of Professional Studies | 17
Working with Text Functions
339TRIM
TRIM
The TRIM function is another cleaning function that removes spacing between words:
=TRIM(text)
For example, if you inherit a list of information and there is random spacing between the
text at different locations, you can trim away the spacing by referencing the cell. For exam-
ple, in Figure 15.12 the left column shows a mixture of spacing. However, by applying the
TRIM function to the right, you can eliminate the spacing. Use the Paste Special command to
paste the cleaned text back into the original column as values. This function is specifically
useful when data is imported from other applications, particularly mainframe and DOS
applications, where spacing often is used as separators in lists and forms.
■ TEXT—This is the text or cell reference containing the text from which you want to
remove all the excess spaces.
15
Substitute this...
...with this
Figure 15.11
The SUBSTITUTE
function replaces one
text string or cell for
another.
19 0789729539 CH15 8/21/03 4:41 PM Page 339
ACLM Institute of Professional Studies | 18
MS Excel : Chapter 3
340 Chapter 15 Text Functions
UPPER
Similar to the LOWER function, the UPPER function converts all text within a cell to uppercase:
=UPPER(text)
For example, =UPPER(“upper”) would result in UPPER. Cell referencing can also be used as
shown in Figure 15.13.
■ TEXT—This is the text or cell reference containing text that you want to change to
uppercase.
15
Random spaces
TRIM function cleans spaces
Figure 15.12
The TRIM function
can trim random
spacing from cells.
Figure 15.13
The UPPER function
converts all text to
uppercase.
19 0789729539 CH15 8/21/03 4:41 PM Page 340
ACLM Institute of Professional Studies | 19
Working with Text Functions
341Excel in Practice
Troubleshooting
Text in Formulas
When using functions such as LEFT and RIGHT, I get the #NAME? error.
If you’re placing text in formulas, enclose the text in quotation marks, such as
=RIGHT(“Bill”,2). An easier way would be to place Bill in a cell such as A1, and then the
formula could be used with cell referencing such as =RIGHT(A1,2).
Excel in Practice
By knowing which text functions do what, you can simplify your life and become extremely
efficient when it comes to managing data. Notice in Figure 15.14 that the initial list has tons
of inconsistencies. By using the following functions, you can quickly clean up and modify
this list: Notice the functions used in cells C16:F16.
■ TRIM function—Removes all the unnecessary spaces in a cell.
■ PROPER function—Creates initial caps on all text.
■ CONCATENATE function—Adjoins text from different cells.
Figure 15.14
Use text functions to
quickly manipulate
poorly organized lists
of information.
CONCATENATE joins text
PROPER styles initial caps
TRIM removes excess spaces
19 0789729539 CH15 8/21/03 4:41 PM Page 341
ACLM Institute of Professional Studies | 20
MS Excel : Chapter 3
Thank You
----------------

More Related Content

What's hot

Application of HCR's Rank Formula on color property of articles
Application of HCR's Rank Formula on color property of articlesApplication of HCR's Rank Formula on color property of articles
Application of HCR's Rank Formula on color property of articlesHarish Chandra Rajpoot
 
Module 6 Mastery
Module 6 MasteryModule 6 Mastery
Module 6 Masterybigerblue
 
Bt0075 rdbms with mysql 2
Bt0075 rdbms with mysql 2Bt0075 rdbms with mysql 2
Bt0075 rdbms with mysql 2Techglyphs
 
lecture 9
lecture 9lecture 9
lecture 9sajinsc
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra OperationsA. S. M. Shafi
 
How to Remove First 4 Characters in Excel
How to Remove First 4 Characters in ExcelHow to Remove First 4 Characters in Excel
How to Remove First 4 Characters in ExcelHarjit Suman
 
4.3 Logarithmic Functions
4.3 Logarithmic Functions4.3 Logarithmic Functions
4.3 Logarithmic Functionssmiller5
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & CalculusAbdullah Khosa
 
Lecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusLecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusemailharmeet
 
Relational algebra.pptx
Relational algebra.pptxRelational algebra.pptx
Relational algebra.pptxRUpaliLohar
 

What's hot (18)

Calc 5.2a
Calc 5.2aCalc 5.2a
Calc 5.2a
 
Join operation
Join operationJoin operation
Join operation
 
Data Structures
Data StructuresData Structures
Data Structures
 
Application of HCR's Rank Formula on color property of articles
Application of HCR's Rank Formula on color property of articlesApplication of HCR's Rank Formula on color property of articles
Application of HCR's Rank Formula on color property of articles
 
Module 6 Mastery
Module 6 MasteryModule 6 Mastery
Module 6 Mastery
 
Lesson
LessonLesson
Lesson
 
Bt0075 rdbms with mysql 2
Bt0075 rdbms with mysql 2Bt0075 rdbms with mysql 2
Bt0075 rdbms with mysql 2
 
lecture 9
lecture 9lecture 9
lecture 9
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
 
How to Remove First 4 Characters in Excel
How to Remove First 4 Characters in ExcelHow to Remove First 4 Characters in Excel
How to Remove First 4 Characters in Excel
 
4.3 Logarithmic Functions
4.3 Logarithmic Functions4.3 Logarithmic Functions
4.3 Logarithmic Functions
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & Calculus
 
Lecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusLecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculus
 
04.formula and fuction
04.formula and fuction04.formula and fuction
04.formula and fuction
 
Relational algebra.pptx
Relational algebra.pptxRelational algebra.pptx
Relational algebra.pptx
 
joins in database
 joins in database joins in database
joins in database
 
0.1 Sets
0.1 Sets0.1 Sets
0.1 Sets
 
Lec02
Lec02Lec02
Lec02
 

Similar to Working with text_aclm

Spreadsheet text functions
Spreadsheet text functionsSpreadsheet text functions
Spreadsheet text functionsAnjan Mahanta
 
Etech. mitch. [autosaved]
Etech. mitch. [autosaved]Etech. mitch. [autosaved]
Etech. mitch. [autosaved]MaridelBajeta
 
Ms excel commands
Ms excel commandsMs excel commands
Ms excel commandsDiyaVerma14
 
Excel advanced formulas and functions i-school tutorials
Excel  advanced formulas and functions   i-school tutorialsExcel  advanced formulas and functions   i-school tutorials
Excel advanced formulas and functions i-school tutorialstechie_govind
 
Introduction to micro soft Training ms Excel.ppt
Introduction to micro soft Training ms Excel.pptIntroduction to micro soft Training ms Excel.ppt
Introduction to micro soft Training ms Excel.pptdejene3
 
Excel Overview.pptx
Excel Overview.pptxExcel Overview.pptx
Excel Overview.pptxNewmanLeke
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functionsVikas Gupta
 
Excel Top 10 formula For The Beginners
Excel Top 10 formula For The BeginnersExcel Top 10 formula For The Beginners
Excel Top 10 formula For The BeginnersStat Analytica
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20Max Kleiner
 
SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)Logan Palanisamy
 
MS Excel_ICT.pptx
MS Excel_ICT.pptxMS Excel_ICT.pptx
MS Excel_ICT.pptxehmzty
 
How to Combine text from two or more cells in Excel
How to Combine text from two or more cells in ExcelHow to Combine text from two or more cells in Excel
How to Combine text from two or more cells in ExcelNick Weisenberger
 

Similar to Working with text_aclm (20)

Spreadsheet text functions
Spreadsheet text functionsSpreadsheet text functions
Spreadsheet text functions
 
Etech. mitch. [autosaved]
Etech. mitch. [autosaved]Etech. mitch. [autosaved]
Etech. mitch. [autosaved]
 
Ms excel commands
Ms excel commandsMs excel commands
Ms excel commands
 
Excel advanced formulas and functions i-school tutorials
Excel  advanced formulas and functions   i-school tutorialsExcel  advanced formulas and functions   i-school tutorials
Excel advanced formulas and functions i-school tutorials
 
Introduction to micro soft Training ms Excel.ppt
Introduction to micro soft Training ms Excel.pptIntroduction to micro soft Training ms Excel.ppt
Introduction to micro soft Training ms Excel.ppt
 
Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
 
Advance excel
Advance excelAdvance excel
Advance excel
 
Excel Overview.pptx
Excel Overview.pptxExcel Overview.pptx
Excel Overview.pptx
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
 
Excel Top 10 formula For The Beginners
Excel Top 10 formula For The BeginnersExcel Top 10 formula For The Beginners
Excel Top 10 formula For The Beginners
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20
 
Excel.useful fns
Excel.useful fnsExcel.useful fns
Excel.useful fns
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
 
Excel formula
Excel formulaExcel formula
Excel formula
 
SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)
 
MS Excel_ICT.pptx
MS Excel_ICT.pptxMS Excel_ICT.pptx
MS Excel_ICT.pptx
 
Mysql1
Mysql1Mysql1
Mysql1
 
lists
listslists
lists
 
Excel functions
Excel functionsExcel functions
Excel functions
 
How to Combine text from two or more cells in Excel
How to Combine text from two or more cells in ExcelHow to Combine text from two or more cells in Excel
How to Combine text from two or more cells in Excel
 

Recently uploaded

URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 

Recently uploaded (20)

URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 

Working with text_aclm

  • 1. ACLM Institute of Professional Studies | 1 Working with Text Functions Working with Text Functions in MS-Excel Designed for Microsoft Office specialist (MOS) Exam - Kumar Amit -
  • 2. ACLM Institute of Professional Studies | 2 MS Excel : Chapter 3
  • 3. ACLM Institute of Professional Studies | 3 Working with Text Functions 15CHAPTER In this chapter Text Functions In this chapter Text Functions Overview 326 CONCATENATE 328 EXACT 329 FIND 330 FIXED 331 LEN 332 LOWER 333 MID 334 PROPER 335 RIGHT 336 Add st, nd, rd, and th to the End of Numbers 337 SUBSTITUTE 338 TRIM 339 UPPER 340 19 0789729539 CH15 8/21/03 4:41 PM Page 325
  • 4. ACLM Institute of Professional Studies | 4 MS Excel : Chapter 3 326 Chapter 15 Text Functions Text Functions Overview Text functions can be used in several ways. They can return the number of characters in text strings, remove extra spaces and nonprintable characters from cells, return exact data within a string, change the case of text strings, and even combine text from other cells. If you inherit workbooks from other people, you will eventually have to clean up or manipulate the data. Text functions allow you to create consistency throughout the workbook. Because cer- tain functions are case sensitive, it’s good practice to create consistency throughout lists and tables. This chapter covers the functions in Table 15.1 that are marked in bold. Table 15.1 Text Functions Function Syntax Description CHAR =CHAR(number) Returns the character specified by a number. CLEAN =CLEAN(text) Removes all nonprintable characters from text. CODE =CODE(text) Returns a numeric code for the first character in a text string. CONCATENATE =CONCATENATE(text1,text2,...) Joins several text strings into one text string. DOLLAR =DOLLAR(number,decimals) Converts a number to text using currency format, with the decimals rounded to the specified place. EXACT =EXACT(text1,text2) Compares two text strings and returns TRUE if they’re exactly the same, and FALSE otherwise. FIND =FIND(find_text,within_text, Finds one text string within another text start_num) string, andreturns the number of the starting position of find_text, from the leftmost character of within_text. FIXED =FIXED(number,decimals, Rounds a number to a specified number of no_commas) decimals, formats the number in decimal format using a period and commas, and returns the result as text. LEFT =LEFT(text,num_char) Returns the first character or characters in a text string based on the number of characters you specify. LEN =LEN(text) Returns the number of characters in a text string. LOWER =LOWER(text) Converts all uppercase letters in a text string to lowercase. 15 19 0789729539 CH15 8/21/03 4:41 PM Page 326
  • 5. ACLM Institute of Professional Studies | 5 Working with Text Functions 327Text Functions Overview MID =MID(text,start_num,num_char) Returns a specific number of characters from a text string, starting at the position you specify. PROPER =PROPER(text) Capitalizes the first letter of each word in a text string and any other letters in text that follow any character other than a letter. REPLACE =REPLACE(old_text,start_num, Replaces a portion of a text string with a num_chars,new_text) different text string based on the number of characters you specify. REPLACEB =REPLACEB(old_text,start_num, Replaces part of a text string with a num_bytes,new_text) different text string based on the number of bytes you specify. REPT =REPT(text,number_times) Repeats text a given number of times. RIGHT =RIGHT(text,num_chars) Returns the last character or characters in a text string based on the number of characters you specify. SEARCH =SEARCH(find_text, Returns the number of the character at within_text, start_num) which a specific character or text string is first found, reading from left to right. SEARCH is not case sensitive and can include wildcard characters. SEARCHB =SEARCHB(find_text, Returns the number of the character at within_text,start_num) which a specific haracter or text string is first found, based on its byte position, reading from left to right. SUBSTITUTE =SUBSTITUTE(text,old_text, Substitutes new_text for old_text in a T new_text,instance_num) text string. Returns the text referred to by =T(value) value. TEXT =TEXT(value,format_text) Converts a value to text in a specific number format. TRIM =TRIM(text) Removes all spaces from text except for single spaces between words. UPPER =UPPER(text) Converts text to uppercase. VALUE =VALUE(text) Converts a text string that represents a number to a number. 15 Function Syntax Description 19 0789729539 CH15 8/21/03 4:41 PM Page 327
  • 6. ACLM Institute of Professional Studies | 6 MS Excel : Chapter 3 328 Chapter 15 Text Functions CONCATENATE The CONCATENATE function is one of the more useful functions you’ll find in Excel. CONCATE- NATE can be used to join text in several forms. One reason it’s useful is when you inherit spreadsheets from other creators you’ll often need to clean up the cells and text. Often, this includes the combination of information within one cell and this is where concatenate comes in. =CONCATENATE(text1,text2,...) Using this function by itself joins a city and state as shown in the first example in Fig- ure 15.1; however, you also can place characters between the adjoined text by inserting them within a pair of open and close quotation marks. 15 N O T E If you adjoin numbers with the ampersand or the CONCATENATE function, the result is converted to text. The characters or text can include spacing, dashes, commas, numbers, other functions, and so on. Notice some of the different ways the CONCATENATE function can join text in separate cells. You can also use the ampersand (&). If you want to adjoin three or more cells with the ampersand, it would appear as follows: =A1&B1&C1. If you want to separate the three cells with a space, it would be =A1&” “&B1&” “&C1. Notice how each adjoined cell or text is sepa- rated by the ampersand. ■ TEXT 1, TEXT 2...—Text is the text to be joined. You can join from 1 to 30 items per cell. Using & to connect strings does NOT have CONCATENATE’s 30-item limit. T I P F R O M 19 0789729539 CH15 8/21/03 4:41 PM Page 328
  • 7. ACLM Institute of Professional Studies | 7 Working with Text Functions 329EXACT EXACT EXACT compares two text strings and returns TRUE if they’re exactly the same, and FALSE otherwise. EXACT is case sensitive. =EXACT(text1,text2) The EXACT function compares two text strings to see whether they are the same. The EXACT function can operate from text within the function or via cell referencing. The EXACT func- tion is case sensitive as shown in the following examples. ■ TEXT 1, TEXT 2...—The text is the first text string and then the second text string. For example: =EXACT(“BILL”,”bill”) results in FALSE. =EXACT(“BILL”,”BILL”) results in TRUE. As you see in Figure 15.2, there are two examples comparing ranges of cells with the EXACT function. The first displays TRUE when an asset is complete using cell referencing. The second compares a single cell reference to a range in the form of an array. If you had a list of assets, and all assets had unique identities, you might want to determine whether the asset is in the list. For this, you would use the EXACT function with the OR function in the form of an array as shown here and in cell F16 of Figure 15.2. Be sure to activate the array by pressing Ctrl+Shift+Enter. ARRAY {=Or(Exact(Cell Reference, Compare Range))} 15 Figure 15.1 The CONCATE- NATE function allows you to join text from separate cells into the same cell. Ampersand joins text with next characters Quotes allow for text insertion 19 0789729539 CH15 8/21/03 4:41 PM Page 329
  • 8. ACLM Institute of Professional Studies | 8 MS Excel : Chapter 3 330 Chapter 15 Text Functions FIND FIND locates one text string with another text string and returns the number of the starting position of find_text, from the leftmost character of within_text. The FIND function is case sensitive. =FIND(find_text,within_text,start_num) ■ FIND_TEXT—The find_text is the text you want to locate or find. ■ WITHIN TEXT—The within_text refers to the text string you’re looking within. ■ START NUM—The start_num refers to the number from left to right from which to start looking for the text. For example, Patrick where the “t” character would be third as the start_num. For example: =FIND(“W”,”Wally Bill”), where W is the first character in the string, results in 1. =FIND(“a”,”Wally Bill”), where a is the second character in the string, results in 2. 15 Figure 15.2 The EXACT function tests two sets of infor- mation and displays a logical value of TRUE or FALSE depending on whether the infor- mation is equal. ...this cell... Compares... ...with this cell Looks up a cell against a range N O T E It’s important to note that FIND looks only for the first instance of the text it’s looking for. If, for example, we were looking for “a” in, “Wally Ball,” the result would still be 2. If you had a cell that contained the names of people and the cities and states they lived in, you could combine the FIND function with the MID function to extract a text string. The MID function is explained later in this chapter. 19 0789729539 CH15 8/21/03 4:41 PM Page 330
  • 9. ACLM Institute of Professional Studies | 9 Working with Text Functions 331FIXED In Figure 15.3, the formula =Mid(C6,1,Find(“ “,C6,1)-1) results in the extraction of the first word, which in this case is a name in the cell, regardless of the length of the first name. The MID function (covered later in this chapter) looks at cell C6 and starts with the first text string; the FIND function also starts with cell C6 and looks for the first space as noted in the quotation marks. The formula then takes the position of the space found and subtracts 1 to return the result. To take this explanation a step further, the formula =Mid(C6,1,Find(“ “,C6,1)-1) extracts the first word from a string regardless of the length of the string. The FIND function looks for a space in the text in cell C6 beginning at character 1. It finds this space at position 6. Then 1 is deducted from this resulting in a formula which now evaluates to this: =Mid(C6,1,5). The MID function (covered later in this chapter) now extracts a five-character string from cell C6 beginning at character position 1. 15 Figure 15.3 The FIND function combined with the MID function can extract text strings in cells regardless of the string length. Subtracts the space and returns the result Finds the space Looks for character number in text string FIXED The FIXED function rounds a number to a specified number of decimals, formats the num- ber in decimal format using a period and commas, and returns the result as text: =FIXED(number,decimals,no_commas) The FIXED function can round numbers in a cell. You can use the FIXED function with text in the function or with cell referencing. Use the FIXED function to round numbers to decimals, hundreds, and thousands. The examples in Figure 15.4 round a number to decimals, tens, hundreds, and thousands using the FIXED function. 19 0789729539 CH15 8/21/03 4:41 PM Page 331
  • 10. ACLM Institute of Professional Studies | 10 MS Excel : Chapter 3 332 Chapter 15 Text Functions ■ NUMBER—The number refers to the number you want to round or convert to text. ■ DECIMALS—The decimals refer to the number of decimal places to the right. If no deci- mals are specified it assumes 2. ■ NO COMMAS—The no commas is a logical result in that if TRUE, it prevents the function from including any commas in the text returned result. For example, the formula =Fixed(2345.24,1,TRUE) would result in 2345.2 without commas. 15 N O T E The difference between FIXED and ROUND is that FIXED returns its answer in the form of text. FIXED results can be used only in other numeric calculations if converted back to a number using the VALUE function. Figure 15.4 Use the FIXED function to round numbers in a cell. LEN LEN returns the number of characters in a text string: =LEN(text) The LEN function on its own returns the number of characters in a text string. For example, if you had the name Bob in cell A1 and you typed in cell B1 =LEN(A1) the result would be 3. This is an extremely powerful tool when combined with other functions. See also, the “RIGHT” function. ■ TEXT—The text refers to the text string, word, or multiple words that you want to find the total number of characters. For example, the formula =LEN(“ Hello”) would result in 5. Because spaces also count as one character, =LEN(“Mn Albany”) would result in 9. While the usefulness of this function may not seem clear, in reality, when combined with other 19 0789729539 CH15 8/21/03 4:41 PM Page 332
  • 11. ACLM Institute of Professional Studies | 11 Working with Text Functions 333LOWER functions in Excel, the LEN function becomes a powerful tool for extracting text strings. If you work in an environment in which you have to clean workbooks that were set up improperly, or you’ve inherited lists of information and have to extract text strings within cells for your own particular purposes, use the LEN function in conjunction with other Excel functions. In the example in Figure 15.5, say you wanted to extract the equipment brand from the equipment type. The function =RIGHT(C17,LEN(C17)-FIND(“ “,C17)) results in Caterpillar, because the function extracts the text to the right of the space. (See the “RIGHT” section later in this chapter.) 15 Figure 15.5 Use LEN with other functions in Excel for text extraction. Returns the result Looks for a space Counts characters in cell Finds right-most character LOWER LOWER converts all letters in a text string to lowercase: =LOWER(text) The LOWER function is primarily a cleaning function. If you have inconsistent data in lists and you want all characters to result in lowercase, use the LOWER function. In Figure 15.6, the LOWER function converts all the uppercase names to lowercase. Use Paste Special and paste as values back into the original location in the list after you’ve converted all charac- ters to lowercase. This function can be used with text in a cell or with cell referencing as demonstrated in the figure. For more information on Paste Special See also Chapter 17, “Setting Up a List or Database in Excel.” ■ TEXT—This is the text within the cell you want to convert to lowercase characters. 19 0789729539 CH15 8/21/03 4:41 PM Page 333
  • 12. ACLM Institute of Professional Studies | 12 MS Excel : Chapter 3 334 Chapter 15 Text Functions MID Use the MID function to return a specific number of characters from a text string, starting at the position you specify: =MID(text,start_num,num_char) ■ TEXT—The text is the text string or word you want to extract from. ■ START_NUM—The start_num is the number of the character within the text string or word you want to extract from. ■ NUM_CHAR—The num_char is the number of characters to extract from the start_num point to the right. You can use text within the formula or use cell referencing. For example, =MID(“Chris”,1,4) returns only the first four characters in the string—Chri. =MID(“Hobbe”,2,4) returns the text string starting with the second character in the string—obbe. Combined with the FIND func- tion, you can create a powerful tool to dynamically extract any text within a string as shown in Figure 15.7 and described in this section. If you have a URL and you want to extract the actual name from a list of URLs and the name appears in different locations in each URL, you could use the following formulas to do so. In cell C6, the formula used to extract any text name from a URL is =MID(B6,FIND(“Sports”,B6),6) 15 Figure 15.6 Use the LOWER func- tion to clean lists of information that are inconsistent. 19 0789729539 CH15 8/21/03 4:41 PM Page 334
  • 13. ACLM Institute of Professional Studies | 13 Working with Text Functions 335PROPER To set up the same formula as shown here with cell referencing, see the formula in Fig- ure 15.7 located in cell E17 and shown here. This will allow you to dynamically pull any text string from a URL. =IF(ISERROR(FIND(C17,B17)),””,MID(B17,FIND(C17,B17),D17)) PROPER PROPER capitalizes the first letter of each word in a text string or sentence. =PROPER(text) The PROPER function is another cleaning tool function. It places initial caps on each word within the text string specified in the formula, or text within a cell if you are using cell refer- encing. The result of =PROPER(“PATRICK”) would be Patrick. Notice that the example in Figure 15.8, used with cell referencing on lists, can quickly clean up the list. ■ TEXT—The text is the text in the text string, word, or sentence to convert to proper. Meaning, the first character is capitalized in each word. 15 Figure 15.7 Use the MID function as a standalone func- tion or in combina- tion with other functions such as FIND. If the name doesn’t appear in the URL, it will return a #Value error. To eliminate this, use the function found in cell C10 in Figure 15.7 and shown here: =IF(ISERROR(FIND(“Sports”,B11)),””,MID(B11,FIND(“Sports”,B11),6)) 19 0789729539 CH15 8/21/03 4:41 PM Page 335
  • 14. ACLM Institute of Professional Studies | 14 MS Excel : Chapter 3 336 Chapter 15 Text Functions RIGHT RIGHT returns the last character or characters in a text string: =RIGHT(text,num_chars) The text can be in the form of text within the formula or as a cell reference. (Refer to the “LEFT” section earlier in this chapter.) The NUM_CHARS argument is the number of characters to return. ■ TEXT—This is the text string, word, or sentence you want to extract characters from. ■ NUM_CHARS—This indicates the number of characters you want to extract starting from the right moving left. For example, =RIGHT(“Patrick”,4) would return rick, as shown in Figure 15.9. When including text within the formula, you need quotes. When you use cell referencing, you don’t. 15 Figure 15.8 The PROPER func- tion creates text with initial caps. 19 0789729539 CH15 8/21/03 4:41 PM Page 336
  • 15. ACLM Institute of Professional Studies | 15 Working with Text Functions 337Add st, nd, rd, and th to the End of Numbers Add st, nd, rd, and th to the End of Numbers You can use the IF, OR, VALUE, RIGHT, and CHOOSE functions together to create automated ordinals, where an ordinal is an adjective used to describe the numerical position of an object. In Figure 15.10, B7 contains the number 1. If your list of numbers begin in cell B7, the formula would be =B7&If(Or(Value(Right(B7,2))={11,12,13}),”th”,If(Or(Value(Right(B7)) ➥={1,2,3}),Choose(Right(B7),”st”,”nd”,”rd”),”th”)) This code adds the following results to the end of ordinary numbers: 1st 2nd 3rd 4th 15 Figure 15.9 The RIGHT function in conjunction with the LEN and FIND functions can be used to extract the right- most words. Counts characters Starting at the right Finds the space 19 0789729539 CH15 8/21/03 4:41 PM Page 337
  • 16. ACLM Institute of Professional Studies | 16 MS Excel : Chapter 3 338 Chapter 15 Text Functions SUBSTITUTE The SUBSTITUTE function replaces old text within a text string with new text. =SUBSTITUTE(text,old_text,new_text,instance_num) The text can be in the formula or used as a cell reference. The examples in Figure 15.11 show the SUBSTITUTE function in the first example using complete cell referencing from one cell to another. The second example gives a mix of cell referencing and text directly in the formula. For the formula =SUBSTITUTE(“Melrose”,C11,”Farming”), where Cll equals Melrose, the result is Farming. ■ TEXT—This is the text in a cell you want to substitute. ■ OLD_TEXT—This is the text you want to replace. ■ NEW_TEXT—This is the new text to replace the old text with. ■ INSTANCE_NUM—This is the number of instances you want to replace the old text with. For example, if you want to replace every occurrence of old text, use “][“. If replacing just one occurrence, use 1. 15 Adds ordinals to ordinary numbers Figure 15.10 You can add ordinals to the end of num- bers automatically. 19 0789729539 CH15 8/21/03 4:41 PM Page 338
  • 17. ACLM Institute of Professional Studies | 17 Working with Text Functions 339TRIM TRIM The TRIM function is another cleaning function that removes spacing between words: =TRIM(text) For example, if you inherit a list of information and there is random spacing between the text at different locations, you can trim away the spacing by referencing the cell. For exam- ple, in Figure 15.12 the left column shows a mixture of spacing. However, by applying the TRIM function to the right, you can eliminate the spacing. Use the Paste Special command to paste the cleaned text back into the original column as values. This function is specifically useful when data is imported from other applications, particularly mainframe and DOS applications, where spacing often is used as separators in lists and forms. ■ TEXT—This is the text or cell reference containing the text from which you want to remove all the excess spaces. 15 Substitute this... ...with this Figure 15.11 The SUBSTITUTE function replaces one text string or cell for another. 19 0789729539 CH15 8/21/03 4:41 PM Page 339
  • 18. ACLM Institute of Professional Studies | 18 MS Excel : Chapter 3 340 Chapter 15 Text Functions UPPER Similar to the LOWER function, the UPPER function converts all text within a cell to uppercase: =UPPER(text) For example, =UPPER(“upper”) would result in UPPER. Cell referencing can also be used as shown in Figure 15.13. ■ TEXT—This is the text or cell reference containing text that you want to change to uppercase. 15 Random spaces TRIM function cleans spaces Figure 15.12 The TRIM function can trim random spacing from cells. Figure 15.13 The UPPER function converts all text to uppercase. 19 0789729539 CH15 8/21/03 4:41 PM Page 340
  • 19. ACLM Institute of Professional Studies | 19 Working with Text Functions 341Excel in Practice Troubleshooting Text in Formulas When using functions such as LEFT and RIGHT, I get the #NAME? error. If you’re placing text in formulas, enclose the text in quotation marks, such as =RIGHT(“Bill”,2). An easier way would be to place Bill in a cell such as A1, and then the formula could be used with cell referencing such as =RIGHT(A1,2). Excel in Practice By knowing which text functions do what, you can simplify your life and become extremely efficient when it comes to managing data. Notice in Figure 15.14 that the initial list has tons of inconsistencies. By using the following functions, you can quickly clean up and modify this list: Notice the functions used in cells C16:F16. ■ TRIM function—Removes all the unnecessary spaces in a cell. ■ PROPER function—Creates initial caps on all text. ■ CONCATENATE function—Adjoins text from different cells. Figure 15.14 Use text functions to quickly manipulate poorly organized lists of information. CONCATENATE joins text PROPER styles initial caps TRIM removes excess spaces 19 0789729539 CH15 8/21/03 4:41 PM Page 341
  • 20. ACLM Institute of Professional Studies | 20 MS Excel : Chapter 3 Thank You ----------------