Search code examples
formulalibreoffice-calc

How can I count how many *pairs of cells* have each element meet a condition?


In LibreOffice Calc, I have two columns (A, B).

I want to count - without adding extra columns, because this operation must be done a large number of times - how many couples (Ai,Bi) meet simultaneously a certain condition on Ai and another certain condition on Bi.

It surely involves array functions, but I don't quite understand how they work.


Solution

  • The function for multiple ranges is COUNTIFS. For example, this formula counts all pairs from rows 1 to 11 where both Ai and Bi are greater than 50.

    =COUNTIFS(A1:A11,">50",B1:B11,">50")
    

    This does not need to be entered as an array formula.