• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 392
  • Last Modified:

CountIf with comparison criteria

Hi,

I have the need to count all numbers in a range where the value in the cell is greater then the cell next to it.

Esentially, for the range a1:z:1
evaluate if a1>a2, count, if not...skip and move move onto
evaluate if b1>b2, count ect.....

Any help is appreciated.
0
MCaliebe
Asked:
MCaliebe
2 Solutions
 
StephenJRCommented:
Do you mean you want to count the number of times a number in row 1 is greater than row 2? If so, try this array formula so use Ctrl+Shift+Enter instead of just enter:

=SUM(IF(A1:Z1>A2:Z2,1))
0
 
Saqib Husain, SyedEngineerCommented:
Array formula
=SUM((A1:Z1>A2:Z2)*1)

Non array formula
=SUMPRODUCT((A1:Z1>A2:Z2)*1)
0
 
MCaliebeAuthor Commented:
Thank you both.  I appreciate seeing both styles of writing this formula.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now