[Solved] Counting number of values within a given range

Discuss the spreadsheet application
Post Reply
RGB3D
Posts: 3
Joined: Wed Nov 15, 2017 7:46 pm

[Solved] Counting number of values within a given range

Post by RGB3D »

I'm sure this must have been explained, but I haven't been able to locate the answer. I have a column of numbers (hundreds of entries in a single column) for which I'd like to count up how many fall within a numeric range (e.g. between 15 and 30). I've tried COUNTIF a number of ways, but I can't figure out how to do the criteria to establish the range within which the number must fall to be counted. I'd love a pointer to a solution. Thanks!
Last edited by Hagar Delest on Fri Nov 24, 2017 9:22 am, edited 1 time in total.
Reason: tagged solved
OpenOffice 4.1.3 on Win7
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Counting number of values within a given range

Post by RusselB »

Use the (currently undocumented) COUNTIFS function.
By getting to the first bracket for the function entered into a cell, you should see a balloon indicating how the rest of the parameters need to be entered.
It is similar, but not the same, as the COUNTIF function.
Alternatively, the SUMPRODUCT function can also work in this manner.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Counting number of values within a given range

Post by Zizi64 »

When the numbers are in the column A, then the COUNTIFS() mathematically equals to:

Code: Select all

=COUNT(A1:A400)-COUNTIF(A1:A400;"<15")-COUNTIF(A1:A400;">30")
or:

Code: Select all

=COUNTIF(A1:A400;">=15")-COUNTIF(A1:A400;">30")
Maybe you need use "<=" and/or ">=" relations.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
RGB3D
Posts: 3
Joined: Wed Nov 15, 2017 7:46 pm

Re: [SOLVED] Counting number of values within a given range

Post by RGB3D »

I'll take a look at the COUNTIFS() function and see how to employ it. I appreciate that new tool. Thanks as well for the mathematically obvious formula (that I overlooked) from Zizi64. Excluding the numbers above the top value in the range is the same as counting just the numbers between. Excellent! The simplest answers are sometimes the best. Works great - thanks, guys!
Last edited by RGB3D on Wed Nov 15, 2017 10:55 pm, edited 1 time in total.
OpenOffice 4.1.3 on Win7
RGB3D
Posts: 3
Joined: Wed Nov 15, 2017 7:46 pm

Re: Counting number of values within a given range

Post by RGB3D »

Works great - thanks! :bravo: (Now how do I mark this solved?)
OpenOffice 4.1.3 on Win7
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Counting number of values within a given range

Post by Zizi64 »

Please edit your first post. Add the [Solved] string to the begining of the Title of this topic.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply