Advanced search in Calc

Hi folks,

My question might have been answererd in the past but my search queries here in the forum were as bad as the title, sorry for that.

I have two columns one with with a drop down menu and one with numbers. I want the sum of all numbers where the value from the dropdown equals some string. In my example below I would look for “string2” and want the result to be 10. I googled around for hours but don’t even get a clue how to solve this.

In Python I would simply loop over column “B” and return the indices to access data in column “A” but I have no idea how to achieve that in calc.

     A      B
1    9      string1
2    7      string2
3    2      string2
4    0      string1
5    1      string2

Any help would be very appreciated

Thanks guys

Hallo

=SUMPRODUCT(B1:B100="string2";a1:a100)

or use in general →Data→Pivottable for Pivot-output with included Filter-dropdowns.

… or =SUMIF(B1:B100;"string2";A1:A100)

Thanks guys that solved it! I would have never been able to come up with that :smiley: