Sie sind auf Seite 1von 9

9/18/2015

CreateasentimentanalysisworksheetinExcel

Home

About

Free Downloads

Products

Help & Support

Search

Recent Articles

Help & Support

SHARE WITH FRIENDS

OfficePower
5likes

HOW YOU CAN USE AN


ADD-IN TO MAKE A QUICKAND-DIRTY SENTIMENT
ANALYSIS SPREADSHEET
WITH EXCEL

Home

Excel

400 level Excel


/

How you can

use an add-in to m
...

LikePage
By Charlie

April 3, 2013

400 level, Excel

add-ins, addins, excel, Excel addin, Excel plug-in, Excel plugin, Excel PowerUps,
formula, office, plug-in, plug-ins, plugin, plugins, powerups, technology, tips, tips and
tricks, tutorial

http://officepowerups.com/2013/04/03/howyoucanuseanaddintomakeaquickanddirtysentimenttrackingspreadsheetwithexcel/

1/9

9/18/2015

CreateasentimentanalysisworksheetinExcel

Note: This post describes some capability you only get by installing an add-in for
Excel. The add-on used here is fully functional and free during its trial period so
youd have plenty of time to try this out.The add-in is called Excel PowerUps
Premium Suite and using the steps below you can create a little sentiment analysis
tool using a feed from the Twitter API. A link to download the free trial is at the
bottom of the page.
Note2: The Twitter API used as an example in this post has been retired. The new
API requires authentication as well as only returning JSON instead of XML. Ill be
looking at adding both of these to the pwrWEBSERVICE and pwrFETCHXMLVIAGET
functions in the weeks to come. When I do so Ill update this post with the details.
The example illustrates using the following PowerUp custom worksheet functions
that are available with the add-in.
pwrURLENCODE
pwrFETCHXMLVIAGET
pwrSENTIMENT
pwrFORMATXML
Each step is covered below, with a screen shot for each to make it easier for you to
follow along.

Step 1
Start with a blank workbook.

Step 2
Insert a label in A2. Just call it Topic.

http://officepowerups.com/2013/04/03/howyoucanuseanaddintomakeaquickanddirtysentimenttrackingspreadsheetwithexcel/

2/9

9/18/2015

CreateasentimentanalysisworksheetinExcel

Step 3
Highlight a box around B2. Well just create a visual place to type in your keywords
later.

Step 4
In D2, enter the following formula:
=pwrFETCHXMLVIAGET(http://search.twitter.com/search.atom?lang=en&q=
&pwrURLENCODE(B2))
Lets break that one down. pwrFETCHXMLVIAGET is a PowerUp function that calls an
XML web service. For the sake of this illustration we chose the twitter search API
which you can learn about athttps://dev.twitter.com/docs/api/1/get/search.
pwrURLENCODE takes the value that will be entered into B2 and URL encodes it.
These strings are concatenated together (&) to create the full API call to Twitter.
http://officepowerups.com/2013/04/03/howyoucanuseanaddintomakeaquickanddirtysentimenttrackingspreadsheetwithexcel/

3/9

9/18/2015

CreateasentimentanalysisworksheetinExcel

Step 5
In B4, enter the following formula:
=pwrPARSEXML(D2, "/feed/entry/title")
This will run the XPATH query in the second parameter against the XML referenced
in the first parameter. This will return the first item the query finds.

Note: As an aid to understanding the XML returned from the web service, you can
use the pwrFORMATXML PowerUp function. You must push the Wrap Text button
on Excels ribbon in order to see the XML in an outline form.

Step 6
Next, highlight about 10 cells, starting at B4 and extend your selection down to
about B14.

http://officepowerups.com/2013/04/03/howyoucanuseanaddintomakeaquickanddirtysentimenttrackingspreadsheetwithexcel/

4/9

9/18/2015

CreateasentimentanalysisworksheetinExcel

Step 7
Click in the formula bar and press CTRL-SHIFT-ENTER to enter an array formula.
When you successfully enter the array formula you see curly braces ({ })
surrounding the function you entered from step 5.

Step 8
In A4, enter the following formula:
=pwrSENTIMENT(B4)
pwrSENTIMENT will scan the text referenced, do a sentiment analysis on that text,
and return a value between -1 and 1. -1 being totally negative, and 1 being totally
positive. A value closer to zero means neutral or undetermined sentiment.
Then, use Excels smart-fill feature to fill down to A14.

http://officepowerups.com/2013/04/03/howyoucanuseanaddintomakeaquickanddirtysentimenttrackingspreadsheetwithexcel/

5/9

9/18/2015

CreateasentimentanalysisworksheetinExcel

Step 9
Almost there. To make it a bit easier to scan lets just use Excels conditional
formatting to add some color. Make sure you have cells A4 thru A14 highlighted.
Then click Conditional Formatting, and then click New Rule.

Step 10
Set the values for Format Style, Minimum, Midpoint, and Maximum as depicted in
the snapshot below. Pay close attention to the values in the Type and Value rows.
When done, click OK.

http://officepowerups.com/2013/04/03/howyoucanuseanaddintomakeaquickanddirtysentimenttrackingspreadsheetwithexcel/

6/9

9/18/2015

CreateasentimentanalysisworksheetinExcel

Step 11
Since the return value from the pwrSENTIMENT PowerUp function is between -1
and 1, lets format it as a percentage. Select A4 thru A14 again. Then click the %
button. Nothing will change just yet.
Thats it. You probably have a blank looking sheet similar to the image below.

Give it a try. Click in B2, and type a keyword or phrase. For example, typefinal four,
and press ENTER.

http://officepowerups.com/2013/04/03/howyoucanuseanaddintomakeaquickanddirtysentimenttrackingspreadsheetwithexcel/

7/9

9/18/2015

CreateasentimentanalysisworksheetinExcel

Youll notice the sentiment ratings are nowhere near exact. And you may find that
for a given topic area, the threshold for positive or negative may vary for you. Its
ultimately up to you to decide how negative or positive a number indicates the
sentiment. Put another way, how close to 100% does the value need to be in order
to generally consider the text positive.
There you go.
To download the Excel PowerUps add-in, click here.

Share this page with friends:


Share

Tweet

Share

Share

Email

How to add a drop-down list to your Excel worksheet


How to change the case of your text in Excel

ADD A COMMENT...
Enteryourcommenthere...

GET NOTIFIED OF NEW POSTS

BROWSE THE CONTENT BUCKETS

Enter your email address to

Excel

subscribe to this blog and receive


notifications of new articles by
email.

100 level
200 level
300 level

http://officepowerups.com/2013/04/03/howyoucanuseanaddintomakeaquickanddirtysentimenttrackingspreadsheetwithexcel/

8/9

9/18/2015

CreateasentimentanalysisworksheetinExcel

Email Address

400 level
InfoPath

Subscribe

SharePoint
Project Server

OFFICEPOWERUPS.COM/FEED

SharePoint Designer
Workflow

How to drag and drop columns in


Excel

Utilities
Development

June 25, 2015


Excel moving average formula and

PowerShell
Word

explanation
June 23, 2015
Excel CONTAINS function June 4,
2015
How to create a boxshot using
Word
May 15, 2015
How to calculate compound
interest in Excel
May 7, 2015
How to compare two strings in
Excel
February 4, 2015
How to Generate Random Text in
Excel
January 23, 2015
How to Hide Gridlines in Excel
December 9, 2014
Return Random Value from List in
Excel
October 22, 2014
How to Create a Burn Down Chart
in Excel (Excel Burndown Chart)
October 16, 2014

About
Developed by Think Up Themes Ltd. Powered by Wordpress.

http://officepowerups.com/2013/04/03/howyoucanuseanaddintomakeaquickanddirtysentimenttrackingspreadsheetwithexcel/

9/9

Das könnte Ihnen auch gefallen