The pwrSENTIMENT PowerUp function performs a sentiment analysis on the text value passed in.
pwrSENTIMENT(value, positivetext|"FILEPATH", negativetext|filepath, neutraltext)
The pwrSENTIMENT PowerUp function has the following arguments:
value – Required. This the text to be evaluated.
positivetext|”FILEPATH” – Optional. Use positivetext to directly provide a pipe-separated set of text or references to indicate new positive sentiment terms or phrases. Alternatively, if you elect to save your updated terms in a separate XML file you may do so. Use “FILEPATH” (including quotes) to indicate the next parameter will contain the file path to your XML file.
negativetext|filepath – Optional, Required. Negativetext is optional, even if positivetext is provided. Negativetext is a pipe-separated set of terms or phrases to augment the pwrSENTIMENT function. To omit the negativetext value but still provide additional neutral terms use a pair of double quotes (“”). Filepath is required if “FILEPATH” is used in the first optional parameter.
neutraltext – Optional. List of pipe-separated neutral terms and phrases to supplement the pwrSENTIMENT function.
pwrSENTIMENT will return a value between -1 and 1.
A return value closer to -1 indicates negative sentiment.
A return value closer to 1 indicates a positive sentiment.
A return value closer to 0 represents a neutral or unclear sentiment assessment.
There is no specific definition of “positive” or “negative” sentiment to apply to the result of pwrSENTIMENT. The context of the text has a great deal to do with the sentiment assessment. For example, you may find that any sentiment assessment larger than 0.45 (45%) is suitable to indicate positive sentiment while a sentiment assessment lower than -0.65 (-65%) is needed to have a good indication of negative sentiment. This is an assessment that you should do when looking at the results of applying pwrSENTIMENT on your specific text.
It is also important to note that sentiment assessment is not an exact measure and ultimately subjective by the reader. pwrSENTIMENT is best used to assess the “gist” of a large set of text elements. Looking at these assessments, trended over time, makes the analysis more interesting.
A sample sentiment XML file is installed with the Excel PowerUps Premium Suite. The name of the file is pwruserglossary.xml and is located in the installation directory (c:\[program files]\PowerUps for Excel).
=pwrSENTIMENT("The Excel Text Analyzer add-in is awesome!!")
Will return a value closer to 1 than -1 because it is considered to be a more positive statement.
=pwrSENTIMENT("The Excel Text Analyzer add-in is awesome!!", "text analyzer|add-in")
Interprets the phrases “text analyzer” and “add-in” as positive.
=pwrSENTIMENT("The Excel Text Analyzer add-in is awesome!!", "", "text", "the")
Interprets the term “text” as negative (no positive additions were provided in this example) and the term “the” is neutral.
=pwrSENTIMENT("The Excel Text Analyzer add-in is awesome!!", "FILEPATH", "c:\program files (x86)\powerups for excel\pwruserglossary.xml")
The contents of the pwruserglossary.xml file are used to augment the pwrSENTIMENT function.
pwrUserGlossary.xml sample contents
<?xml version="1.0" encoding="UTF-8"?> <userglossary> <positive-strong>awesome|i love it|super cool</positive-strong> <positive-mild>seems ok|nice</positive-mild> <negative-strong>absolutely horrible|unacceptable</negative-strong> <negative-mild>not cool|too expensive|not forthcoming</negative-mild> <neutral>a|the|of</neutral> </userglossary>