Google Sheets Formula Category List: How to Build One
In this article
To build a formula category list in Google Sheets, put your categories in one column, then use a helper column with =IFERROR(SEARCH("run",A2),0)-style logic, or the simpler COUNTIF plus dropdown approach, to tag and group each row. The fastest reliable pattern is: raw data on one sheet, a category column filled by a data-validation dropdown, and a summary built with COUNTIF, SUMIF or FILTER. That gives you a list you can sort, count and reuse without retyping anything.
What You'll Need
- A Google Account with access to Google Sheets (the browser version at sheets.google.com, or the mobile app).
- A dataset with at least one text column you want to categorise, such as product names, expenses, or device names.
- One free column next to your data for the category values, and one empty sheet or empty area for the summary.
- No add-ons are required. Everything below uses built-in functions.
Step-by-Step
- Open your sheet and label the columns. Put headers in row 1. For example, A1 = Item, B1 = Category, C1 = Amount. Keep row 1 for headers only; formulas work best when the data starts in row 2. Menu labels in Sheets can differ slightly by version, device and region, but the functions themselves behave the same.
- Create a master list of categories somewhere out of the way. On a second sheet (right-click a sheet tab and choose Duplicate or Insert sheet), type your category names in one column, for example E2:E8 on a sheet named Lists: Home, Auto, Food, Utilities, Health, Other. This is your source of truth. Every dropdown and formula will point here, so adding a new category later updates everything at once.
- Turn the category column into a dropdown. Select the cells in B2 down to the last data row, then go to Data > Data validation > Add rule. Choose Dropdown, pick the range from your Lists sheet (for example Lists!E2:E8), tick Show dropdown list in cell, and choose what should happen on invalid data (Reject input is the safest). Click Done.
- Fill in categories for existing rows. Click a cell in B and use the small arrow to pick a value from your list. Do this for every row, or paste a column of known values and let validation flag anything that does not match.
- Build the category list itself with UNIQUE. On your summary sheet, in cell A2, type
=UNIQUE(Lists!E2:E8)to list each category once. If you want the list pulled from data that already has categories assigned, use=UNIQUE(B2:B)instead. Either way you now have a clean, duplicate-free list. - Count rows per category with COUNTIF. Next to the first category in B2, enter
=COUNTIF($B$2:$B$1000,A2)and drag or copy it down. The dollar signs lock the range so it does not shift as you fill. This gives you the number of items in each category. - Add totals per category with SUMIF. In C2, enter
=SUMIF($B$2:$B$1000,A2,$C$2:$C$1000)to sum the Amount column for each category. If your amounts are in a different column, adjust the third range only. - Pull the matching rows for any category with FILTER. In a separate area, put a category name in E1 and in F1 type
=FILTER(A2:A1000,B2:B1000=E1). This returns every item in that category. If nothing matches, you get a #N/A error, which is expected and can be wrapped:=IFERROR(FILTER(A2:A1000,B2:B1000=E1),"None"). - Sort the summary so it reads sensibly. Select the summary range, then Data > Sort range. You can also wrap the list in
=SORT(UNIQUE(B2:B1000))so the categories always appear alphabetically without manual sorting. - Test a change. Add a new category name on the Lists sheet, then re-open a dropdown cell. The new option should appear. If you used
=UNIQUE(B2:B), the summary updates only after at least one row uses the new category; if you used=UNIQUE(Lists!E2:E8), it appears immediately.
Common Mistakes
Typing categories by hand instead of using a dropdown. This creates near-duplicates like "Food" and "food" or "Home" and "Home ". Sheets treats them as different values, so your counts silently split. Validation prevents this.
Forgetting the dollar signs. COUNTIF(B2:B1000,A2) copied down becomes COUNTIF(B3:B1001,A3), and the counts drift. Lock the ranges with $.
Mismatched ranges. In SUMIF, the criteria range and sum range must be the same height. SUMIF(B2:B1000,A2,C2:C999) returns wrong or erroring results.
Pointing the dropdown at a range that later moves. If you insert rows above your Lists values and your validation range was not a named range, the dropdown options shift. Consider selecting the list and using Data > Named ranges to give it a stable name.
Using a fixed list when data drives the categories. A static list will not show a category that exists in the data but not in the list. If you want the list to reflect reality, build it from the data with UNIQUE.
Tips
Use Named ranges (Data > Named ranges) for both your category list and your data columns. Formulas become readable: =COUNTIF(Category, A2) instead of a long range reference, and they survive row insertions.
Wrap summary formulas in IFERROR so a blank or missing category shows a dash rather than an error, which keeps the sheet printable and presentable.
Turn the summary range into a pivot table instead of formulas if you want grouped counts and totals in one step: select the data including headers, then Insert > Pivot table, put Category in Rows and drag your count or amount field into Values. Pivot tables update when you refresh or change the source, though new categories may need the pivot's range widened.
Add a totals row with =SUM(B2:B8) under your counts to verify that categories add up to your total row count. A mismatch means a row has no category assigned.
On the Sheets mobile app, the same commands sit under the plus button and the Data menu; dropdowns and formulas work, but bulk ranges are much easier to select on desktop.
Troubleshooting
The dropdown shows an error or will not save. Check that the range you selected contains only one column or one row of values, and that the sheet name in the reference matches exactly. Spaces in sheet names need quotes, like 'My List'!A2:A10.
COUNTIF returns 0 for a category you can clearly see. Look for trailing spaces or inconsistent capitals. Use =TRIM(B2) in a helper column and count on that, or use Data > Data cleanup if your version offers Trim whitespace or Remove duplicates.
FILTER returns #N/A. That simply means no rows match. Confirm the category text matches exactly (case does not matter, but spelling and spaces do), then wrap it in IFERROR.
The summary does not update after new data. Your formula range probably stops at an old last row. Change the ranges to open-ended ones like B2:B, which extend to the bottom of the sheet, and re-copy the formulas.
Formulas show as text instead of calculating. The cell is likely formatted as plain text. Select it, choose Format > Number > Automatic, then re-enter the formula.
If that did not work, make a copy of the sheet (File > Make a copy) and rebuild the summary with one formula at a time, checking the result after each. This isolates which reference is wrong without risking your original data.
Frequently Asked Questions
Can I build a category list without formulas?
Yes. Type categories into a column and use Insert > Pivot table on your data. It groups and counts automatically, and you can refresh it when the data changes.
What is the difference between UNIQUE from a list and from data?
Pointing at a fixed list shows every category you have defined, even unused ones. Pointing at the data column shows only categories actually in use, and updates as rows are edited.
Can I have subcategories?
Use two columns, Category and Subcategory, and concatenate them with =A2&" / "&B2 in a helper column. Count and filter on the combined value.
Will the list break if I insert rows?
Open-ended ranges like B2:B and named ranges handle inserted rows well. Fixed ranges like B2:B1000 may miss rows added beyond the limit.
Does this work in Excel too?
Mostly. COUNTIF, SUMIF, FILTER and UNIQUE exist in current Excel versions, but dropdown setup uses Data Validation and dynamic array behaviour differs slightly. Expect small differences in range-spilling rules.