countif greater then and smaller then + if

excelNewbie22

Well-known Member
Joined
Aug 4, 2021
Messages
510
Office Version
  1. 365
Platform
  1. Windows
hi,
whats wrong with my formula?
i need to know if the number of zeros in the range are greater then 0 and smaller then 5,
but as you can see it return TRUE for 6 zeros and also for no zeros

Excel Formula:
=COUNTIF(N19:S19,0)>0 - COUNTIF(N19:S19,0)>5

test.xlsb
NOPQRS
17TRUE
18TRUE
19000000
20111221
test
Cell Formulas
RangeFormula
N17:N18N17=COUNTIF(N19:S19,0)>0 - COUNTIF(N19:S19,0)>5
 

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
Simplistically, maybe this filled down from N17:
Code:
=AND(COUNTIF(N19:S19,0)>0,COUNTIF(N19:S19,0)<5)
 
Upvote 0
Solution
Try to use countif, but you have to use aspas in criteria
=countif(N19:S19,">0""<6")
 
Upvote 0
I'm not sure what you're counting. but here is a way to calculate numbers >0 and <5

mr excel questions 33.xlsm
NOPQRSTU
30000000
41112216
ExcelNewbie22
Cell Formulas
RangeFormula
U3:U4U3=SUM((--(N3:S3>0))*(--(N3:S3<5)))
 
Upvote 0
kweaver thanks you!
fluff was right, it doesn't works
awoohaw - didn't need to count bigger then zero, just if the amount of zeros are....
thanks everyone!
 
Upvote 0
Another way would be
Excel Formula:
=ABS(COUNTIF(N19:S19,0)-2.5)<2
 
Upvote 0

Forum statistics

Threads
1,215,201
Messages
6,123,617
Members
449,109
Latest member
Sebas8956

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