Formaula to calculate "between"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone help me with writing a formula that will count how many enteries
fall between two numbers? Example: How would I find all cells that have a
value between 4 & 6 in the below scenario? The answer that I'm looking to
return is 1.

column A
1
5
8
9
 
One way is

=countif(A1:A4,">4")-countif(A1:A4,">6")

NOTE: The ">6" argument is not a typo.

A second way is

=sumproduct(--(A1:A4>4),--(A1:A4<6))

Can anyone help me with writing a formula that will count how many
enteries
fall between two numbers? Example: How would I find all cells that
have a
value between 4 & 6 in the below scenario? The answer that I'm looking
to
return is 1.

column A
1
5
8
9
 
You can use a more complicated COUNTIF formula, but for this problem I would
use two COUNTIF's

=COUNTIF(A1:A4,">=3")-COUNTIF(A1:A4,">6")

If the end points are in cells such as B1 and C1

=COUNTIF(A1:A4,">="&B1)-COUNTIF(A1:A4,">"&C1)
 
Thank you for your help!

Myrna Larson said:
You can use a more complicated COUNTIF formula, but for this problem I would
use two COUNTIF's

=COUNTIF(A1:A4,">=3")-COUNTIF(A1:A4,">6")

If the end points are in cells such as B1 and C1

=COUNTIF(A1:A4,">="&B1)-COUNTIF(A1:A4,">"&C1)
 
Thank you for your help!

BenjieLop said:
One way is

=countif(A1:A4,">4")-countif(A1:A4,">6")

NOTE: The ">6" argument is not a typo.

A second way is

=sumproduct(--(A1:A4>4),--(A1:A4<6))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top