Excel Countif Modulus on list of values

Hi Experts

I've got the following sample data in a single column in my XLS:


I need a formula to calculate the number of values in this data range that have a modulus of 0.35 to 0.50 (both values inclusive) - the correct answer is: 2

What is the formula I should use?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:

=SUMPRODUCT(--(MOD(A1:A12,1)>=0.35),--( MOD(A1:A12,1)<=0.5))
wesmanbigmig13Author Commented:
Thanks Norie - this looks promising, however I just tried the following on this set of values and it should return a result of 2, but instead it returns a result of 1...

=SUMPRODUCT(--(MOD(C59:C70,1)>=0.18), --(MOD(C59:C70,1)<=0.21))

Seems like it isn't including one of the values 0.18 or 0.21 ...?
wesmanbigmig13Author Commented:
Testing further, it seems like it is the less than or equal to value (<=0.21) which it isn't including correctly, because if I change the formula to the following:

=SUMPRODUCT(--(MOD(C59:C70,1)>=0.18), --(MOD(C59:C70,1)<=0.22))

it returns the correct result of 2. Why does the <= function not work correctly? It seems to be ignoring the = to part of only working on the < part...
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

NorieAnalyst Assistant Commented:
Can you show the other set of data you tried it on?

Perhaps upload a sample workbook?
wesmanbigmig13Author Commented:
Hi Norie - please see attached file. The result for the formula should be 3, but Excel shows 2
NorieAnalyst Assistant Commented:
I think this is a caused by the way Excel, well computers, store decimalnumbers, see here.

If we use the ROUND function to round to 2 decimal places the correct result is returned.

=SUMPRODUCT(--(ROUND(MOD(A1:A12,1),2)>=0.21), --(ROUND(MOD(A1:A12,1),2)<=0.34))

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wesmanbigmig13Author Commented:
Perfect, thanks Norie. Worked a charm!


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.