How to compare values between two rows with a condition

100 Views Asked by At

I have values in two rows and I need to compare the cells in each column except the ones where is one of the two cells (or both of them) blank and get a result of how many values in row 4 is greater than the ones in row 5.

It looks like this Example

The result in this case should be 3.

Is there any way how to do it only with one formula?

2

There are 2 best solutions below

0
Max Makhrov On BEST ANSWER

=ArrayFormula(SUM((4:4>5:5)*(4:4<>"")*(5:5<>"")))

  • (A) * (B) * (C) ... - and logic
  • (A) + (B) + (C) ... - or logic
1
GokuMizuno On

I was unable to find a single formula to do this in.

I tried both =sum(if((a1:g1)>(a2:g2);1;0)), as well as =total(foreach(if((a1:g1)>(a2:g2);1;0)))

and they simply evaluated to zero.

As far as I know, it looks like you will have to use two formulae,

=if((a1>a2);1;0) through =if((g1>g2);1;0)

then

sum(a3:g3), where a3...g3 is the above if statements.