COUNTIF problem

ptm555

New Member
Joined
Jun 17, 2008
Messages
24
I realise this one's probably small fry for you all, but here goes anyway.

I'm trying to count the number of times certain values occur in range. The values I want to find are:
between 0 and 1 (i.e. less than 1)
between 1 to 2 (i.e. including values of 1.0 but less than 2.0)
between 2 to 3 etc etc

This is the formula I am using for 'between 1 and 2' is:
=COUNTIF($U$2:$U$1323,">=1")-COUNTIF($U$2:$U$1323,">2")

The formula for '0 to 1' is easy and works, but the above formula for the rest is giving me too high a number. What am I doing wrong?:rolleyes:
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I realise this one's probably small fry for you all, but here goes anyway.

I'm trying to count the number of times certain values occur in range. The values I want to find are:
between 0 and 1 (i.e. less than 1)
between 1 to 2 (i.e. including values of 1.0 but less than 2.0)
between 2 to 3 etc etc

This is the formula I am using for 'between 1 and 2' is:
=COUNTIF($U$2:$U$1323,">=1")-COUNTIF($U$2:$U$1323,">2")

The formula for '0 to 1' is easy and works, but the above formula for the rest is giving me too high a number. What am I doing wrong?:rolleyes:

That should work too...

See whether the following yields the same result as it should...

=SUMPRODUCT(--($U$2:$U$1323 >=1 ),--($U$2:$U$1323 < 2))
 
Upvote 0
Try:

=sumproduct(--($U$2:$U$1323>=1),--($U$2:$U$1323<2))

You were trying to do >=1 and >2 in your formula and not between.
 
Upvote 0
I'm thinking you need >=2 in the second formula to also subtract the 2s. Does that do it? Do you have any blanks in the data, or other potential spoilers?

AB
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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