Professional Documents
Culture Documents
Part - A Spreadsheet (Excel) Lab 4
Part - A Spreadsheet (Excel) Lab 4
Contents
1.LEFT Function.....................................................................................................................................1
How to Use the LEFT Function with a Defined Length of Characters.............................3
How to use the LEFT Function on a Range of Cells............................................................4
2. Excel MID Function Syntax.................................................................................................................6
Examples......................................................................................................................................6
3.Excel LEN Function Syntax..................................................................................................................7
Excel LEN Function Examples..........................................................................................................7
4.RIGHT Function...................................................................................................................................8
How to use the RIGHT function with a defined length of characters..........................10
How to use the RIGHT function used on a range of cells................................................................12
5.SUBSTITUTE Function.......................................................................................................................14
Examples...................................................................................................................................14
6.LEN Function.....................................................................................................................................15
Syntax.............................................................................................................................................15
Examples...................................................................................................................................15
7.SEARCH Function..............................................................................................................................16
Purpose.........................................................................................................................................16
Return value.................................................................................................................................16
Syntax............................................................................................................................................16
Basic Example.........................................................................................................................16
TRUE or FALSE result...........................................................................................................17
1.LEFT Function
The LEFT function is used to retrieve a chosen amount of characters,
counting from the left side of an Excel cell. The chosen number has to be
greater than 0 and is set to 1 by default.
It is typed =LEFT
If you want to use the function on a single cell, write:
=LEFT(cell)
1. Select a cell E2
2. Type =LEFT
3. Double click the LEFT command
1. Select a cell E2
2. Type =LEFT
3. Double click the LEFT command
Step 2) Select cells and set the number of characters
4. Enter the cell name (A2) and define the length of characters you want
to retrieve, using a , as a delimiter (A2,3)
5. Hit enter
1. Select a cell E2
2. Type =LEFT
3. Double click the LEFT command
4. Select the cells (A2:A4) and define the length of characters you want to
retrieve, using a , as a delimiter (A2:A4,3)
5. Hit enter
The function returns the first 3 characters from each cell within the
range A2:A4.
2. Excel MID Function Syntax
The MID function in Excel returns text of a certain length from the inside of
a string (neither the leftmost nor the rightmost). The MID function takes
three arguments:
text - The original string of text, either as a cell reference or as a string enclosed
in quotes
start - The number of the starting character of the desired text (the first character
is 1, the second is 2, and so on)
length - The number of characters to extract from the original string
Examples
=MID("Some text", 3, 5)
The function above returns the string "me te". See explanation below:
=MID("Some text")
------123456789
--------12345
=MID(A3, 2, 5)
Jennifer
12345678
-12345
=MID(D1, 2, 2)
SALES
12345
--
The LEN function takes one argument (value within the parenthesis) which
is typically text, but could also be numerical or a date value. LEN then
returns the length, in characters, of the argument. LEN includes characters
such as spaces and punctuation in the character count. LEN can take a cell
reference which contains text or a string of text enclosed in quotes as its
argument.
=LEN("Some text")
=LEN("Some text")
------123456789
=LEN(A2)
Bob
123
=LEN(A3)
This LEN formula would return 8. Why? The string "Jennifer" contains 8
characters.
Jennifer
12345678
=LEN(C2)
32
12
4.RIGHT Function
The RIGHT function is used to retrieve a chosen amount of characters,
counting from the right side of an Excel cell. The chosen number has to be
greater than 0 and is set to 1 by default.
It is typed =RIGHT
=RIGHT(cell)
To retrieve values from the right side of an Excel cell, use RIGHT.
1. Select a cell E2
2. Type =RIGHT
3. Double click the RIGHT command
1. Select a cell E2
2. Type =RIGHT
3. Double click the RIGHT command
4. Enter the cell name (A2) and define the length of characters you want
to retrieve, using a , as a delimiter (A2,3)
5. Hit enter
1. Select a cell E2
2. Type =RIGHT
3. Double click the RIGHT command
Step 2) Select cells and number of characters
4. Select the cells (A2:A4) and define the length of characters you want to
retrieve, using a , as a delimiter (A2:A4,3)
5. Hit enter
The function returns the last 3 symbols from each cell within the
range A2:A4.
5.SUBSTITUTE Function
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.
Syntex.
=SUBSTITUTE(text,old_text,new_text,[instance])
instance - [optional] The instance to replace. If not supplied, all instances are
replaced.
Examples
Below are the formulas used in the example shown above:
6.LEN Function
The Excel LEN function returns the length of a given text string as the number of characters. LEN will
also count characters in numbers, but number formatting is not included.
Syntax
=LEN(text)
Examples
LEN returns the count of characters in a text string:
=LEN("apple") // returns 5
The LEN function often appears in other formulas that manipulate text in some way.
For example, it can be used with the RIGHT and FIND functions to extract text to the
right of a given character:
Purpose
Get the location of substring in a string
Return value
A number representing the location of substring
Syntax
=SEARCH(find_text,within_text,[start_num])
Basic Example
The SEARCH function is designed to look inside a text string for a specific
substring. If SEARCH finds the substring, it returns a position of the substring in the
text as a number. If the substring is not found, SEARCH returns a #VALUE error. For
example:
=SEARCH("p","apple") // returns 2
=SEARCH("z","apple") // returns #VALUE!
TRUE or FALSE result
To force a TRUE or FALSE result, nest SEARCH inside the ISNUMBER function.
ISNUMBER returns TRUE for numbers and FALSE for anything else. If SEARCH
finds the substring, it returns the position as a number, and ISNUMBER returns
TRUE:
8.ISNUMBER Function
Purpose
Test for numeric value
Return value
A logical value (TRUE or FALSE)
Syntax
=ISNUMBER(value)
Examples
The ISNUMBER function returns TRUE if value is numeric:
=SUMPRODUCT(--ISNUMBER(range))
The double negative coerces the TRUE and FALSE results from ISNUMBER into
1s and 0s and SUMPRODUCT sums the result.