How to do sentiment analysis in Excel and Google Sheets
Sentiment analysis means labelling each piece of text by the feeling behind it: usually positive, neutral or negative, sometimes a score from 1 to 5. It's how you get from a column of 2,000 reviews or survey comments to a sentence like "complaints doubled after the price change".
This guide shows three ways to do it in Excel or Google Sheets, and, just as important, how to check whether the results are any good.
Prepare the data
- One comment per row, in a single column. If a review has a title and a body, join them:
=B2 & ". " & C2. - Remove empty rows and exact duplicates (Data → Remove Duplicates in Excel, Data → Data cleanup in Sheets).
- Keep an ID column so you can match results back to the original records later.
- Decide what the labels mean for you. Is "fine, I guess" neutral or negative? Is a review that praises the food but hates the service positive, negative or mixed? Write it down; it matters for every method below.
Method 1: a word-list formula
The classic approach: count positive words and negative words in each comment, and label it by whichever side wins.
- On a separate sheet, list positive words in one column (great, love, excellent, friendly, recommend…) and negative words in another (terrible, rude, broken, slow, refund…). Use lowercase.
- Name the two ranges: select each list and type
PosWordsandNegWordsinto the Name Box (or use Formulas → Define Name; in Sheets, Data → Named ranges). Make the ranges cover exactly the words, with no blank cells. - With the comment in A2, use:
=LET(t, " " & LOWER(A2) & " ",
p, SUMPRODUCT(--ISNUMBER(SEARCH(" " & PosWords & " ", t))),
n, SUMPRODUCT(--ISNUMBER(SEARCH(" " & NegWords & " ", t))),
IF(p > n, "Positive", IF(n > p, "Negative", "Neutral")))
The spaces around each word stop bad from matching inside badge. LET works in Excel 365, Excel 2021 and Google Sheets. On older Excel, write it without LET:
=IF(SUMPRODUCT(--ISNUMBER(SEARCH(" "&PosWords&" ", " "&LOWER(A2)&" ")))
> SUMPRODUCT(--ISNUMBER(SEARCH(" "&NegWords&" ", " "&LOWER(A2)&" "))), "Positive",
IF(SUMPRODUCT(--ISNUMBER(SEARCH(" "&NegWords&" ", " "&LOWER(A2)&" ")))
> SUMPRODUCT(--ISNUMBER(SEARCH(" "&PosWords&" ", " "&LOWER(A2)&" "))), "Negative", "Neutral"))
Where word lists go wrong
- Negation: "not good" and "not bad" both get counted the wrong way.
- Sarcasm: "Great, another two-hour wait" scores as positive.
- Punctuation: because of the spaces, "great!" won't match "great". You can strip common punctuation first with
SUBSTITUTE, or drop the spaces and accept some false matches. - Missing words: people describe experiences ("waited 45 minutes for a cold burger") without using any word on your list, so many rows fall to Neutral.
It's free and transparent, and good enough to spot big shifts in a large volume of comments. For row-by-row accuracy, it's usually the weakest of the three.
Method 2: AI functions built into your spreadsheet
At the time of writing, Excel (with a Microsoft 365 Copilot license) and Google Sheets (on Workspace plans that include Gemini) both offer AI functions you can call from a cell with an instruction like "classify this review as positive, neutral or negative". Check whether your plan includes them.
- Good: no setup, and they understand context, sarcasm and negation far better than word lists.
- Watch out for: usage limits on large ranges, results that can change when the sheet recalculates (copy and paste them as values once you're happy), answers that don't always stick to your exact labels, and no confidence score to tell you which rows to double-check.
Method 3: a dedicated classification tool
With SheetSorter you upload the file, pick the comment column and use the ready-made Positive / Neutral / Negative labels (or define your own, or a 1–5 scale). Every row comes back with one of your exact labels, a confidence score and a "needs review" flag.
In our tests on public review data, it told positive from negative reviews apart correctly about 98% of the time, and its 1–5 ratings were within one star of the reviewer's actual rating 97% of the time. Exact five-star matches were lower, around 68%, which is normal: people don't agree on the difference between a 3 and a 4 either.
Check the accuracy, whatever you use
Every method makes mistakes; the question is how many. Ten minutes of checking tells you:
- Add a helper column with
=RAND(), sort by it, and take the first 50 rows. That's a random sample. - Label those 50 yourself in a new column, without looking at the method's answer.
- With your labels in C2:C51 and the method's in B2:B51, the share that match is:
=SUMPRODUCT(--(B2:B51 = C2:C51)) / ROWS(B2:B51)
Above about 85% on three labels is good. If it's lower, look at the rows that disagree: they usually point to a label that needs a clearer definition.
Summarize the results
Count each label with COUNTIF, and divide by the total for a share:
=COUNTIF(B:B, "Negative") / COUNTA(B2:B5000)
For trends, a PivotTable with the review date grouped by month in Rows, Sentiment in Columns and a count in Values shows how the mix changes over time. A stacked column chart of that table makes it easy to share.
Finally, read some of the negative comments themselves. The percentage tells you how many people are unhappy; the comments tell you why.
Want to skip the formulas? Find out which reviews and comments are positive, neutral or negative, for every row of your spreadsheet.