MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 26th, 2002, 12:58 AM   #1
Wakster
New Member
 
Join Date: May 2002
Location: Buckinghamshire, England
Posts: 3
Default

I have a column of numbers and wish to count any that come between 5 and 10 (6.2,7,9.5 for example) and if possible any numbers that come between 10 and 15.

Thanks in Advance

Wakster
Wakster is offline   Reply With Quote
Old May 26th, 2002, 01:10 AM   #2
Nimrod
MrExcel MVP
 
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
Default

You may want to look at the "Frequency" formula
Nimrod is offline   Reply With Quote
Old May 26th, 2002, 01:12 AM   #3
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-05-25 23:58, Wakster wrote:
I have a column of numbers and wish to count any that come between 5 and 10 (6.2,7,9.5 for example) and if possible any numbers that come between 10 and 15.

Thanks in Advance

Wakster
Lets say that the numbers are in column A.

In D1 enter: 5
In E1 enter: 10
In D2 enter: 10
In E2 enter: 15

In F1 enter and copy down:

=COUNTIF(A:A,">="&D1)-COUNTIF(A:A,">="&E1)

Adjust the ranges to suit. The formula counts numbers between lower limit inclusive and upper limit exclusive.


[ This Message was edited by: Aladin Akyurek on 2002-05-26 01:58 ]

[ This Message was edited by: Aladin Akyurek on 2002-05-26 02:01 ]
Aladin Akyurek is offline   Reply With Quote
Old May 26th, 2002, 01:58 AM   #4
Wakster
New Member
 
Join Date: May 2002
Location: Buckinghamshire, England
Posts: 3
Default

Thank you,

The countif solution worked.

I will also try the frequecy function if i can find out how it works.
Wakster is offline   Reply With Quote
Old May 26th, 2002, 03:13 AM   #5
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-05-26 00:58, Wakster wrote:
Thank you,

The countif solution worked.

I will also try the frequecy function if i can find out how it works.
To count by using FREQUENCY,

in B1:B4 enter:

{4;9;14;19}

in C1 enter and copy down:

=INDEX(FREQUENCY($A$1:$A$17,$B$1:$B$4),ROW())

The figure below shows this side by side with the COUNTIF version (lower limit inc, upper limit exc, see my edited reply with COUNTIF).

Microsoft Excel - aaFrequencyVsCountif Wakster.xls___Running: xl2000 : OS = Windows (32-bit) NT 5.00
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp
A1=15

A
B
C
D
E
F
1
154:alert('=INDEX(FREQUENCY($A$1:$A$17,$B$1:$B$4),ROW())')>3510:alert('=COUNTIF($A$1:$A$17,%22%3E=%22&D1)-COUNTIF($A$1:$A$17,%22%3E=%22&E1)')>7
2
19:alert('=INDEX(FREQUENCY($A$1:$A$17,$B$1:$B$4),ROW())')>71015:alert('=COUNTIF($A$1:$A$17,%22%3E=%22&D2)-COUNTIF($A$1:$A$17,%22%3E=%22&E2)')>5
3
514:alert('=INDEX(FREQUENCY($A$1:$A$17,$B$1:$B$4),ROW())')>51520:alert('=COUNTIF($A$1:$A$17,%22%3E=%22&D3)-COUNTIF($A$1:$A$17,%22%3E=%22&E3)')>1
4
619:alert('=INDEX(FREQUENCY($A$1:$A$17,$B$1:$B$4),ROW())')>1


5
3




6
7




7
8




8
5




9
9




10
11




11
10




12
12




13
5




14
2




15
20




16
14




17
12




Sheet1

To see the formula in the cells just click on the cells hyperlink

The above image was automatically generated by [HtmlMaker V1.27]
If you want FREE SOFT, click here and Colo will email the file to you
This code was graciously allowed to be modified: by Ivan F Moala All credit to Colo


Aladin

Aladin Akyurek is offline   Reply With Quote
Old May 26th, 2002, 03:26 AM   #6
Wakster
New Member
 
Join Date: May 2002
Location: Buckinghamshire, England
Posts: 3
Default

Thanks Aladin
The time and trouble you have gone to on my behalf is much appreciated.

Two quick questions if I may,

What does the & symbol in the formula do? and of the two solutions which one would you use?
Wakster is offline   Reply With Quote
Old May 26th, 2002, 03:52 AM   #7
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Two quick questions if I may,

What does the & symbol in the formula do?


& is the concatenate operator that forces Excel to evalutate its AFTER argument and glue the result of the evaluation to its BEFORE argument:

">="

is the BEFORE arg and

D1

the AFTER arg in

">="&D1

The evaluation of D1 simply results in the value that D1 houses. So we get:

">=5"

if D1 houses 5 as value.

If D1 houses a formula like =AVERAGE(F1:F10), the average that is computed will be glued to the BEFORE argument in an expression like

=COUNTIF(A1:A10,">="&AVERAGE(F1:F10))

and of the two solutions which one would you use?

The COUNTIF version will be a bit faster than the FREQUENCY version of the formulas. Moreover, constructing the 'bins' that are required for the FREQUENCY function can be a bit hard if you are not used to it. Otherwise, it won't matter much which function you use.

Aladin
Aladin Akyurek is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 10:24 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes