Forum Discussion
Lcardona
Sep 30, 2025Occasional Reader
Need Help with Name Manager
So, I created a name for name manager. Essentially, I am keeping track of daily tasks through certain departments (which are color coded) and counting those colors to add the time spent on each depar...
Kidd_Ip
Oct 01, 2025MVP
Take this as an alternative:
- Use a Helper Column Instead of Color
Instead of relying on cell color, add a column where users select the department from a dropdown (e.g., “Sales”, “HR”, “Finance”). Then use formulas like COUNTIF or SUMIF to track time.
=SUMIF(B2:B100, "Sales", C2:C100)
Where:
- Column B = Department
- Column C = Time spent
This is 100% portable, doesn’t rely on macros, and works across all versions of Excel.
- Use Conditional Formatting for Visuals
You can still color-code cells using Conditional Formatting based on department names. This keeps the visual appeal without tying logic to cell color.
- If You Must Use Color, Use VBA Carefully
If you still want to count by color, here’s a simple VBA function you can include in your workbook:
Function CountColor(rng As Range, colorCell As Range) As Long
Dim cell As Range
Dim count As Long
count = 0
For Each cell In rng
If cell.Interior.Color = colorCell.Interior.Color Then
count = count + 1
End If
Next cell
CountColor = count
End Function
Then use it like:
=CountColor(A2:A100, A1)
Where A1 has the color you want to count.