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

10/6/2009

Text Functions

• LEFT • FIND
DATA HANDLING - I • RIGHT • SEARCH
• MID • CONCATENATE
Techniques for cleaning data • TRIM • REPLACE
• LEN

(c) MSF (c) MSF

LEFT, RIGHT and MID


• LEFT extracts n characters from the left of a
text string.
Let us understand the usage of these functions
before we apply them to an actual data handling • RIGHT extracts n characters from the right of a
problem. text string.

• MID extracts n characters starting at position k


in a text string.

(c) MSF (c) MSF

1
10/6/2009

LEFT, RIGHT and MID TRIM and LEN


• TRIM removes all spaces between words
except for the single spaces. Thus if there
were 3 spaces between the first and last
Open the worksheet textfunctions for a demo name, then the trimmed result will have just
one space.

• LEN returns the total number of characters in


a text

(c) MSF (c) MSF

TRIM and LEN FIND and SEARCH

• FIND returns the start of the first occurrence


Open the worksheet textfunctions for a demo
of a string within a text. FIND is case sensitive.

• SEARCH works in a similar fashion to FIND


except that it is not case sensitive.

(c) MSF (c) MSF

2
10/6/2009

Syntax of FIND and SEARCH FIND and SEARCH

=FIND( text you want to locate,


where?, In cells D9, D10 and D11 of the worksheet
start searching from what position? textfunctions , we demonstrate these functions.
)

SEARCH has the same syntax as FIND.

(c) MSF (c) MSF

The CONCATENATE Function The REPLACE Function

Syntax:
CONCATENATE merges two or more strings into =REPLACE(old text, k, m, new text)
one.
REPLACE starts at position k and overwrites the
In Cell D12 we use this function to join the next m characters of the old text with the new
strings stored in cells E2 and E3. text.

(c) MSF (c) MSF

3
10/6/2009

Application of Text Functions Removing Duplicates


Have a look at this data

My data contains three fields: product


description, product ID, and product price.
Unfortunately, the worksheet I received had
all three fields packed into one cell.

How do I put the fields in different columns in


order to begin my analysis?

(c) MSF (c) MSF

Removing Duplicates Removing Duplicates


We want to know the following information:
All we have to do is to ignore the duplicate
• Who are the sales persons involved in the entries in the three columns separately.
transactions?
This can be done by inspection but if the data is
• What products were sold? large then we might commit errors (after
wasting a lot of time!)
• What regions were covered?

(c) MSF (c) MSF

4
10/6/2009

Removing Duplicates Filtering Data


First select the name column. Let us ask some simple questions about our data:
Next point to Data -> Filter -> Standard Filter
1. What transactions yielded more than $280 revenue
and more than 90 units of sale?

2. What transactions occurred in the last three months


of 2005, or the first three months of 2006?

3. What are the top 30 transactions in terms of the


revenue?
(c) MSF (c) MSF

Filtering Data Conditional Formatting


All these questions can be answered at a click of the Helps us to quickly identify cells that satisfy a criteria
mouse with the Filter wizard that you have just used. like which cells have names starting with ‘R’ etc.

First define the formatting in


Data -> Filter -> AutoFilter Format -> Styles and Formatting

Questions 1 & 3 can be answered using the standard Next go to Format -> Conditional Formatting
filter option. and specify the conditions to highlight the desired
Question 2 needs Advanced Filter.
values.
(c) MSF (c) MSF

5
10/6/2009

Database Functions Database Functions

1. How many dollars worth lip gloss did Jen sell?

2. How much revenue was generated in the east


region or by Emilee?

3. What was the earning of Colleen or Zaret by selling


lipstick in the east region?
For this data, we want to know the following
Information:
(c) MSF (c) MSF

The DSUM Function Points to Remember


=DSUM( data range,
B3:G27 • It is essential to include the exact column labels in
what column, the criteria range.
5
criteria for summation
) • Entries in the columns of the criteria range are
ANDed.
criteria for summation is the
range containing the information • Entries in the rows of the criteria range are ORed.
We will now see an example of this.

(c) MSF (c) MSF

6
10/6/2009

More than 1 row in criteria The DSUM Function


criteria range is specified as

What do you think the criteria


range

to calculate the quantity:

earning of Emilee + earning in will calculate?


the east region

OO will not add Emilee’s east


earning twice
(c) MSF (c) MSF

Database Functions The DCOUNT Function


=DCOUNT( data range,
B3:G27
4. How many lipstick transactions did not take place in what column,
the east? any column that
contains numeric entries
criteria range
5. How many dollars worth lipstick did Jen sell during )
the year 2004?
criteria range is specified as

6. How many units of makeup were sold for a price of


at least $3.20? to count the number of
transactions that did not take
(c) MSF
place in the east.
(c) MSF

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