0
votes

I'm just wanting to have a formula to count the amount of cells from E4:X4 if the number in each cell in that range is equal to the number in the cell directly above it. I was trying doing a COUNTIF with an INDIRECT ADDRESS for the cells above but didn't get anything so I was probably doing it quite wrong. Just to be very clear for example if in that range cell E4 is 5 and above it (E3) is also 5 then to count it, and not count it if it isn't. Same for every cell down to X4. Thanks.

1

1 Answers

1
votes

You can use Sumproduct for that. In the screenshot, the formula in cell I2 is

=SUMPRODUCT(--(A1:G1=A2:G2))

enter image description here

To count only non-empty cells, you can change the formula to

=SUMPRODUCT(--(A1:G1=A2:G2),--(A2:G2<>""))

enter image description here