How to make stats in calc based on text labels?

Hi,

how can I make stats in calc based on labels ?

I want to know how much time is spent on each activities ?

thanks for your help

Welcom @phil12345678910 !
What about =COUNTIF($B$2:$F$23;"garden")*30? It will be time in minutes

nice, can it be done based on colors ?

Yes, you can (in most cases). But why? Color is not a value - only numbers (including dates), text strings and formulas make sense for Calc. To calculate the background value of a cell, you need to write a macro. To iterate over the cells of the sheet, you need a macro. To get a macro you need to learn how to program. And this is much more complicated than using what is already there for calculations - a function that works with the value of the cell, and not with its design. Here you have colored your table. Yes, it’s nice. But on what basis did you apply the color to the cell? Have you looked at the contents of the cell? Calc does exactly the same thing when he colorizes cells with different colors using Conditional Formatting. In other words, do not try to solve the problem difficult - there may not be time for more interesting things.
(There is a solution, it has been repeatedly published here in different versions. For example, this topic)

because a color represents a type of activity, but I could have different labels

I am a professional developer (many many languages), and I have been behind many screens for >30 years so…

thanks for the answer I’ll dig this out