Calc: sum cells values having same background color

In Calc I need to sum cells values only if the cells have the same background color.

  • The colors are defined and identify persons
  • Some cells may have the same value but different color (person)

Here you can view an example of what I mean.

Thank you for any hint.

Thankyou mariosv, this thread [Calc, Basic] Introspective cell functions was helpfull and gave me an effective solution, but I can pass as parameters only absolute cells values (for example CELL_BACKCOLOR(1; 2; 5) indicates $sheet1.$B$5). I want to refer to relative values, for example CELL_BACKCOLOR(1; row(B5); column(B5)) as written in that thread, but this returned a #NAME? error.

I think you can find some help in this threads:

Background Color Cell Count.

[Calc, Basic] Introspective cell functions

This is the right way: [Calc, Basic] Introspective cell functions

I’m using the italian localization of LibreOffice.
The correct localized sintax is not

CELL_BACKCOLOR(1; row(B5); column(B5))