Cellhue logoCellhue

Sum and count cells by font color in Google Sheets

Updated November 7, 2026

Sometimes the color is in the text, not the cell: overdue amounts in red, confirmed ones in green. Google Sheets has no function that sums or counts by font color, but you can filter by text color, or use SUMBYFONTCOLOR and COUNTBYFONTCOLOR from Cellhue.

Without an add-on: filter by text color

  1. Choose Data → Create a filter.
  2. Click the filter icon in the column header, then Filter by color → Text color, and pick the color.
  3. Outside the filtered rows, use =SUBTOTAL(109, B2:B50) to sum or =SUBTOTAL(103, B2:B50) to count the visible cells.

This shows one color at a time and the result depends on the current filter.

With Cellhue: SUMBYFONTCOLOR and COUNTBYFONTCOLOR

=SUMBYFONTCOLOR(B2:B50, "#ff0000")
=COUNTBYFONTCOLOR(A:A, "#ff0000")
=SUMBYFONTCOLOR(B2:B50, D1)

Which red is my red?

The default Sheets "red" text is #ff0000, but the palette has several reds (#e06666, #cc0000, #990000 and more), and each counts as its own color. If a total looks too small, run Analyze selection in Font color mode: it lists every color actually used, so you can see whether two similar reds are mixed. Pointing to a sample cell like D1 also avoids typing the code.

Common questions

Can I count by fill color and font color together?

Each formula checks one kind of color. Use COUNTBYCOLOR for fill and COUNTBYFONTCOLOR for text, in separate cells.

Does it see text colored by conditional formatting?

No, only the font color set on the cell. For rule-based colors, use SUMIF or COUNTIF with the rule's condition.

Working with cell fill colors? See sum by color and count colored cells.

Try Cellhue

Color formulas that work like SUM and COUNTIF, a sidebar that shows every color in a range, and refresh when colors change. Free plan for fill colors; Pro is a $19 one-time payment.

Coming soon to Google Workspace Marketplace Read the help