Count number of cells in a range that are >=x or <=-x

CapRavOr

New Member
Joined
Apr 26, 2022
Messages
7
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
I can't seem to figure out why I can't count the number of cells in a range that meet a given criteria. E.g. if the table below was a range A1: D4, count the number of cells >=.25 or <=-.25, should result in 4
My formula: =COUNTIFS(AM78:BC85,">=.25",AM78:BC85,"<=-.25")
.1.05.2.25
.4.5.05.04
.05.01.07.17
.15.09.05.27
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Give this a try:
Excel Formula:
=COUNTIFS(AM78:BC85,">="&.25,AM78:BC85,"<="&-.25)
 
Upvote 0
How about
Excel Formula:
=sum(COUNTIFS(AM78:BC85,{">=.25","<=-.25"}))
 
Upvote 0
Give this a try:
Excel Formula:
=COUNTIFS(AM78:BC85,">="&.25,AM78:BC85,"<="&-.25)
That will always return 0!

The multiple conditions in a COUNTIFS are always treated as an AND, not an OR.
It is impossible for any number to be greater than 0.25 AND less than -0.25 at the same time.
 
Upvote 0
Excel Formula:
=SUM((AM78:BC85<=-0.25)+(AM78:BC85>=0.25))
 
Upvote 0
That will always return 0!

The multiple conditions in a COUNTIFS are always treated as an AND, not an OR.
It is impossible for any number to be greater than 0.25 AND less than -0.25 at the same time.
Ah, makes sense. Thanks. I was just focused on the syntax.
 
Upvote 0
Ah, makes sense. Thanks. I was just focused on the syntax.
I must admit, I have been guilty of that myself on a few occasions.
Focused so much on the syntax, I forget to verify the logic!
It happens to all of us!
 
Upvote 0
Excel Formula:
=SUM(--ABS(AM78:BC85)>=.25)
(May need to use CNTL-SHFT-ENTR keystroke if you're using one of your earlier versions of excel)
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top