How to classify text in Google Sheets

You have a column of support tickets, survey answers, reviews or lead notes, and you need each row put in a bucket. There are four honest ways to do it in Sheets, and the right one depends almost entirely on two things: whether your categories can be spotted by keyword, and how many rows you have.

1. Keyword rules, with no AI at all

Start here. It costs nothing, runs instantly, never hits a quota, and gives the same answer every time:

=IFS(
  REGEXMATCH(LOWER(A2), "refund|money back|chargeback"), "Billing",
  REGEXMATCH(LOWER(A2), "crash|error|bug|broken"),        "Technical",
  REGEXMATCH(LOWER(A2), "price|quote|demo"),              "Sales",
  TRUE,                                                    "Other")

People skip this because it feels unsophisticated, and then spend a week on something that performs worse. If your categories really are separated by words that appear in the text, rules win outright: they are auditable, free, and a colleague can see exactly why a row landed where it did.

They fail where you would expect. “I've been charged twice since cancelling” is billing without the word refund. “Great, another outage” is not praise. Anything relying on paraphrase, negation or tone will slip through, and the “Other” bucket quietly fills up with the interesting rows. Check how big Other gets: that number tells you whether to move on.

2. The built-in AI function

Google Sheets has =AI() (also written =GEMINI()), which sends a prompt and a range to Gemini from inside a cell. It understands language, so it handles the cases rules cannot.

=AI("Which team: billing, technical or sales?", A2)

Three things from Google's own documentation decide whether it fits your job. It needs an eligible Google Workspace or Google AI plan, so it is not there on every account. Its responses are limited to text. And when you select a range and generate, only the first 350 selected cells with AI functions are generated, on top of short-term and long-term generation limits that can make you wait a day.

So: excellent for a few dozen rows on a plan that includes it, awkward for a column of five thousand. (Limits checked September 2026 — Google changes them, so read that page rather than trusting this one.)

3. Apps Script calling a model yourself

Extensions → Apps Script, a UrlFetchApp call to whichever API you like, wrapped in a custom function. Total control, no third party in the middle, and you pick the model.

It is also more work than it looks the moment you go past a few hundred rows. Custom functions time out. You will write batching, because one call per row is slow and expensive. You will write retries, because the API will rate-limit you. You will write caching, because Sheets recalculates and you do not want to pay twice for the same cell. None of that is hard; all of it is a maintained thing you now own. Worth it if you have unusual requirements or data that cannot leave your own account. Not worth it to put tickets in three buckets.

4. A formula that returns a number

This is what we build, so take the framing with the appropriate salt — the facts are checkable.

=LIKELY(A2:A5000, "Is the customer asking for a refund?")
  → 0.98, 0.01, 0.97, 0.27 …

Every row gets a probability from 0 to 1 rather than a word. That difference matters more than it sounds. You can sort the column and read the top. You can set your own threshold instead of accepting someone else's. And you can find the rows in the middle — “Why was I billed after cancelling?” comes back around 0.27 — which are exactly the rows a human should look at. A hard label throws all three away and tells you nothing about how sure it was.

For labels and scales there are =LIKELY_CHOICE(range, question, "billing, technical, sales") and =LIKELY_SCORE(range, question, "1, 2, 3, 4, 5"). 5,000 rows come back in about a second, and judging a cell you have already judged with the same question is free.

Which one to use

SituationUse
Categories separated by obvious keywordsRules. Free, instant, auditable.
A few dozen rows, and you have a qualifying plan=AI(). It is already there.
You want a sentence back, not a category=AI(). Likely cannot write.
Thousands of rows you need to sort or thresholdAn add-in built for bulk.
Unusual requirements, or data that cannot leave your accountApps Script, and accept the maintenance.

Writing a question that classifies well

Whichever method you pick, the question does most of the work:

Try it on your own text

There is a demo on the front page that runs on text you paste, with no signup and no card. A free key is 2,000 rows a month if it turns out to be useful.

Get a free key Read the docs

Written 22 September 2026. Third-party limits and plan requirements change; the links above are the authority, not this page.