Docs/Sources/Analyze Sentiment

Analyze Sentiment

Analyze text sentiment

OperationalCredits 10 per callp50 573msAI/Computer Vision

Overview

Sentiment Analysis runs two independent scorers over the `text` you POST. The first is lexicon-based: the text is tokenised, each token is looked up in the AFINN list of integer valences from -5 to +5, and the matches are summed into `sentiment`. `comparative` divides that sum by the token count. `sentimentText` maps the sum to a label with fixed cut-offs: 4 and above is very positive, 2 to 3 positive, -1 to 1 neutral, -2 negative, and -3 or below very negative. `isPositive` and `isNegative` are only the sign of the sum, so a score of 1 returns `isPositive: true` while the label still reads neutral.

On paid plans the text is also split into sentences at terminal punctuation and line breaks, and the first 50 sentences go to a transformer classifier trained on social media text. Each sentence gets positive, neutral and negative probabilities. `modelScore` is the mean positive probability minus the mean negative probability, rounded to two decimals, and `modelSentiment` is the label with the highest mean. `isMixed` is true when at least one sentence is labelled positive and another negative, each with confidence of 0.6 or more; `modelSentiment` then reads `mixed`.

`normalizedScore` is the AFINN sum divided by 10 and clamped to -1..1, so any text scoring 10 or more in either direction saturates. `magnitude` is the sum of absolute valences and grows with length: use it to tell strongly worded text from flat text, not to compare documents of different sizes. The free plan skips the model call entirely, so the model fields are null there.

Live Test Analyze Sentiment Source →

Formula

One function covers the whole catalog: the first argument names the source, the next are its inputs, and the field after them says which single value lands in the cell. Formulas covers the grammar that applies to all of them.

=VERVE("sentimentanalysis", A2, "comparative")

A2 holds the text you are looking up. Drag the formula down and each row resolves on its own.

With literal values

Nothing has to come from a cell — typed values work the same way.

=VERVE("sentimentanalysis", "I absolutely love this product! It exceeded all my expectations.", "comparative")

Inputs

Required inputs are positional, in the order below, followed by the field. Everything else is passed as a "name", value pair after that — the same shape as SUMIFS. Premium inputs are accepted on every plan but only take effect on plans that include them.

InputTypeWhere it goesDescription
textRequiredstringargument 2 (A2)The text to analyze the sentiment of
length 0–50000

What lands in your sheet

The field — the argument after the inputs — is what makes the formula resolve to one cell. Its value is a dot-path from the table below, so swapping it is how you pull a different value — one formula per column.

Seeing everything at once

Leave the field out and the formula returns the whole response instead: two columns, field name on the left and value on the right, spilling from the cell you typed in.

=VERVE("sentimentanalysis", A2)
Good for exploring, not for filling down

The second row's table would land on top of the first's, and every cell after the first reads #REF! (#SPILL! in Excel). Keep one per sheet, or name a field, and leave the cells below and to the right empty.

Response fields

Paths are relative to data. Each one is exactly what the field argument accepts, so swapping it is how you pull a different value into a cell. On a plan without a Premium field the cell reads #PREMIUM(field) rather than a value, so a locked field never looks like a real answer.

Use as the fieldTypeExample cell valueDescription
comparativenumber0.25The sentiment score divided by the number of words, so long and short texts compare
sentimentTextstringpositiveThe score read as a label: very positive, positive, neutral, negative or very negative
sentimentnumber3AFINN sentiment score: the summed valence of the matched words, negative for negative sentiment
isPositivebooleantrueWhether the sentiment is positive
isNegativebooleanfalseWhether the sentiment is negative
normalizedScorePremiumnumber0.3Sentiment score normalized to -1 to 1 range
magnitudePremiumnumber3Total emotional strength: the summed absolute valence of every matched word, so strongly mixed text scores high even when sentiment nets to zero
positiveWordsPremiumarray["excited"]The distinct words that pushed the AFINN score up
negativeWordsPremiumarray[]The distinct words that pulled the AFINN score down, including positive words negated by not or never
modelSentimentPremiumstringpositiveOverall label from a transformer sentiment model read sentence by sentence: positive, neutral, negative, or mixed when the text has a confident positive and a confident negative sentence; null if the model is unavailable
modelScorePremiumnumber0.98Model score from -1 (negative) to 1 (positive): the mean positive minus the mean negative probability across sentences
isMixedPremiumbooleanfalseTrue when at least one sentence is confidently positive and another confidently negative (model confidence 0.6 or higher)
sentencesPremiumarray[2]Per-sentence model results for the first 50 sentences
sentences.0.textPremiumstringI'm so excited that tomorrow is going to be sunny!The sentence as split from the input
sentences.0.labelPremiumstringpositivepositive, neutral or negative
sentences.0.confidencePremiumnumber0.992Model probability of the label, 0 to 1
sentences.0.scoresPremiumobject{…}Probability of each label
sentences.0.scores.positivePremiumnumber0.992Probability the sentence is positive
sentences.0.scores.neutralPremiumnumber0.006Probability the sentence is neutral
sentences.0.scores.negativePremiumnumber0.002Probability the sentence is negative

Filling a whole column

Both platforms make one batched call for a column rather than one request per cell, and both cost the same — 10 credits per row looked up. How you write it differs, because the two runtimes batch at different points.

Rows 2–100 in one call
=VERVE("sentimentanalysis", A2:A100, "comparative")

In Google Sheets, give the arguments ranges and the answers spill down from the cell you typed in. Custom functions there run synchronously and in isolation, so dragged cells cannot be coalesced — the range form is how a column becomes one call. The field is required here: a per-row two-column table has nowhere to spill. Use a full column per input (A2:A100, not A2) — a single-cell reference is read as row 1 only and the rest of the column comes back blank.

In Excel, type the formula once and fill down — no range form and none needed, because its runtime is asynchronous and the add-in coalesces the calls a fill produces into a single batched request. Do not hand VERVE.CALL a range: Excel flattens it into positional arguments, so A2:A100 arrives as a hundred separate arguments and the cell reads #ERR rather than filling.

Either way, column A holds your text values and the answers land beside them, one row each, blank rows skipped.

When a cell doesn't fill

A failed lookup returns readable text starting with #ERR rather than a spreadsheet error, because Excel cannot show a custom message on a real error — you would get a bare #VALUE! with no reason. The trade-off is that IFERROR() will not catch it; test with LEFT(cell, 4) = "#ERR" instead. Error handling covers the rest.

Cell readsWhat happened
#ERR Not connectedNo API key saved. Open the side panel and connect your account.
#ERR Replace <name> with a cell or valueA preview formula was copied as-is. Swap the placeholder for a cell reference.
#ERR No "x" in sentimentanalysisAn option name this source does not take. The message lists the ones it does.
#ERR No data point "…"The field path is not in the response. Check it against the table above.
#PREMIUM(field)The field exists but your plan does not include it.
#ERR Out of creditsThe cycle's credits are spent. Usage resets on your billing date.

Before the formula works

The add-in reads the API key you saved once in the side panel — the key never goes in the formula, so a shared sheet does not leak it and a collaborator without access simply sees the last calculated values.

  1. Install the add-in for Google Sheets or Excel.
  2. Open the side panel and sign in, or paste a key from your dashboard.
  3. Type the formula above into any cell.

Use cases

Support Ticket Escalation
Route angry customer messages to senior support reps immediately when the sentiment score drops to very negative.
Review Stream Filtering
Product managers categorize incoming app store feedback into positive praise and negative complaints using the five-tier sentiment label.
Social Media Sentiment Analysis
When tracking brand tags on social networks, marketing teams flag sudden spikes in negative valence scores to address PR issues early.
Survey Response Sorting
Sort open-ended employee survey responses automatically by comparative sentiment to isolate recurring workplace grievances without manual reading.

Other ways to use Analyze Sentiment

Set up Analyze Sentiment on VerveSheets, or reach the same source a different way. Your VerveSheets account and credits work on all of them — one key, one balance.

Call it as a REST APIOne HTTPS endpoint and an x-api-key header, with SDKs for Node, Python and .NET.APIVerve →Reference →
Give it to an AI agentConnect over MCP and your agent calls it as a native tool — Claude, Cursor, ChatGPT.VerveKit →Reference →
Ground an agent on itA cited, machine-checkable fact your model can't produce on its own.VerveContext →Reference →

More in AI/Computer Vision:

Was this page helpful?