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 Nov 19th, 2002, 09:45 PM   #1
RJB
 
Join Date: Jul 2002
Posts: 149
Default

Need a formula that will count the number of occurrences of that same number in three different ranges. The number that is to be compared to is in a cell that is a result of a formula. Example:
Lowest number found in three ranges: 30 (Answer is in A1)
Question: how many times does that number appear in the three ranges?
Syntax:
=Countif(Range1,range2,range3=A1)
Has to equal the cell reference value (A1), not a plain number (like 30)
RJB is offline   Reply With Quote
Old Nov 19th, 2002, 10:27 PM   #2
PaddyD
MrExcel MVP
 
Join Date: May 2002
Posts: 12,813
Default

anything wrong with 3 countif's, or an equivalent ?!? Excel's not usually too happy performing calculations on non-contiguous ranges, so if the ranges are non-contiguous, having a single range name for the 3 ranges wont solve the problem...

paddy
PaddyD is offline   Reply With Quote
Old Nov 19th, 2002, 10:41 PM   #3
RJB
 
Join Date: Jul 2002
Posts: 149
Default

Yes they are contigious. Would the three countifs yield three different answers, like below?
Range1=1 Range2=0 Range3=2
This would solve the problem somewhat, but was hoping to save the space, reduce the possibility of error by getting just get one answer.
RJB is offline   Reply With Quote
Old Nov 19th, 2002, 10:42 PM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 42,648
Default

Quote:
On 2002-11-19 17:41, RJB wrote:
Yes they are contigious. Would the three countifs yield three different answers, like below?
Range1=1 Range2=0 Range3=2
This would solve the problem somewhat, but was hoping to save the space, reduce the possibility of error by getting just get one answer.
What are the exact ranges?
Aladin Akyurek is offline   Reply With Quote
Old Nov 19th, 2002, 10:43 PM   #5
PaddyD
MrExcel MVP
 
Join Date: May 2002
Posts: 12,813
Default

if the ranges are contiguous, you could simply add a new name that covered all three ranges...
PaddyD is offline   Reply With Quote
Old Nov 19th, 2002, 11:22 PM   #6
RJB
 
Join Date: Jul 2002
Posts: 149
Default

Answered the contiguous question wrong. They are NOT contiguous. The formula (if it worked would look something like this)

=Countif(F7:24,F29:F42,F53:F65,"=S2")

S2 is the cell reference from which to compare. That number is derived from a MIN formula over the same ranges.
RJB is offline   Reply With Quote
Old Nov 19th, 2002, 11:53 PM   #7
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 42,648
Default

Quote:
On 2002-11-19 18:22, RJB wrote:
Answered the contiguous question wrong. They are NOT contiguous. The formula (if it worked would look something like this)

=Countif(F7:24,F29:F42,F53:F65,"=S2")

S2 is the cell reference from which to compare. That number is derived from a MIN formula over the same ranges.
You can get away with...

=COUNTIF(F7:F24,S2)+COUNTIF(F29:F42,S2)+COUNTIF(F53:F65,S2)
Aladin Akyurek is offline   Reply With Quote
Old Nov 19th, 2002, 11:57 PM   #8
PaddyD
MrExcel MVP
 
Join Date: May 2002
Posts: 12,813
Default

Quote:
=Countif(F7:24,F29:F42,F53:F65,"=S2")
I prefer using sumproduct to sumif / countif ('cos I'm happy with possibly having to sacrifice a little performance for not having to mess about with the quotation marks!)

=sumproduct((F7:F24=s2)+0)+sumproduct((F29:F42=s2)+0)+sumproduct((F53:F65=s2)+0)
PaddyD is offline   Reply With Quote
Old Nov 20th, 2002, 12:07 AM   #9
RJB
 
Join Date: Jul 2002
Posts: 149
Default

You win the prize

That worked on existing scenario...I will try it on various scenarios over the next week or so just to make sure.

Thanks very much



RJB is offline   Reply With Quote
Old Nov 20th, 2002, 01:05 AM   #10
RJB
 
Join Date: Jul 2002
Posts: 149
Default

PaddyD

Now that you are hot, can you do the same thing with the RANK function. Rank results over non-contiguous columns/cells?

References are the same as the SUMPRODUCT formula
=RANK(F7,F7:F24,F32:F45 etc.etc)
RJB 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 +1. The time now is 03:59 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2010 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