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 19th, 2002, 07:05 PM   #1
golszews
New Member
 
Join Date: May 2002
Posts: 5
Default

Hello there,

I would describe my level of proficiency at excel to be above intermediate.
However, despite all attempts, I cannot come up with a simple function:

I have a spreadsheet of various data, including names, simple yes/no
entries and DATES. It is with the dates (regardless of how they formatted
to appear) that I am having difficulty with. I need to sum the number of
times a date (eg. any day in April 2002) appears in a particular column.

name1 surname1 21/04/2002
name2 surname2 02/04/2002
name3 surname3 03/03/2001
name4 surname4 17/04/2002
"" this is where there needs to appear "3"

I have tried every variation of COUNTIF, COUNT, SUM, etc, etc.

Please help. Thankyou.
Gosia

Gosia.Olszewski@uts.edu.au
golszews is offline   Reply With Quote
Old May 19th, 2002, 07:59 PM   #2
PaddyD
MrExcel MVP
 
Join Date: May 2002
Posts: 13,278
Default

Gosia,

Don't know what going wrong with the countif problem (which I managed to replicate), but you could use the following entered as an array formula (using Control + shift+ enter):

=SUM(IF(MONTH(B20:B23)=4,1,0))

Hope this helps,

Paddy
PaddyD is offline   Reply With Quote
Old May 19th, 2002, 08:38 PM   #3
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Here is another array formula ... (if your data is in cells B20:B23, as Paddy assumed):

{=SUM((MONTH(C1:C4)=4)+0)}

Regards!


Yogi Anand is offline   Reply With Quote
Old May 19th, 2002, 08:42 PM   #4
PaddyD
MrExcel MVP
 
Join Date: May 2002
Posts: 13,278
Default

Yogi (or anyone else)...

any idea why the original countif version didn't work (for me, it fell over when trying to xtract the month portion of the dates)? I can only guess that countif doesn't like evaluating some sorts of expressions?!?

Paddy
PaddyD is offline   Reply With Quote
Old May 19th, 2002, 08:55 PM   #5
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-05-19 19:42, PaddyD wrote:
Yogi (or anyone else)...

any idea why the original countif version didn't work (for me, it fell over when trying to xtract the month portion of the dates)? I can only guess that countif doesn't like evaluating some sorts of expressions?!?

Paddy
Hi Paddy:
I don't believe that the criterion portion in CountIf allows for a computation (such as month(c1:c4)=4)

However if I compute the months and add them in corresponding cells in column D, I could easily use;

=COUNTIF(D1:D4,"=4")

Regards!

[ This Message was edited by: Yogi Anand on 2002-05-19 20:03 ]
Yogi Anand is offline   Reply With Quote
Old May 19th, 2002, 09:01 PM   #6
PaddyD
MrExcel MVP
 
Join Date: May 2002
Posts: 13,278
Default

Yogi,

Thanks!
Paddy
PaddyD is offline   Reply With Quote
Old May 19th, 2002, 09:06 PM   #7
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Hi Paddy, I just edited my earlier post in regard to use of COUNTIF to indicate that if I did use a column D to show computed months, I could use

=COUNTIF(D1:D4,"=4")
Yogi Anand is offline   Reply With Quote
Old May 19th, 2002, 09:13 PM   #8
PaddyD
MrExcel MVP
 
Join Date: May 2002
Posts: 13,278
Default

Yogi,

Thanks again. I generally use sum as an array for 'countif' purposes - it provides you with all the flexibility of the rest of excells functions.
It might also be worth pointing out the 'countif' has known (although obscure)bugs (see micrsoft site for details)
Paddy
PaddyD is offline   Reply With Quote
Old May 20th, 2002, 01:51 AM   #9
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-05-19 18:05, golszews wrote:
Hello there,

I would describe my level of proficiency at excel to be above intermediate.
However, despite all attempts, I cannot come up with a simple function:

I have a spreadsheet of various data, including names, simple yes/no
entries and DATES. It is with the dates (regardless of how they formatted
to appear) that I am having difficulty with. I need to sum the number of
times a date (eg. any day in April 2002) appears in a particular column.

name1 surname1 21/04/2002
name2 surname2 02/04/2002
name3 surname3 03/03/2001
name4 surname4 17/04/2002
"" this is where there needs to appear "3"

I have tried every variation of COUNTIF, COUNT, SUM, etc, etc.

Please help. Thankyou.
Gosia

Gosia.Olszewski@uts.edu.au
COUNTIF (for counting) and SUMIF (for summing) cannot work with multiple conditions. Multiconditional counting or summing requires other means: SUMPRODUCT, array-entered formulas, database functions like DCOUNT or DSUM.

=COUNTIF(Range,MONTH(date-range)=4) [ illegal ]

will not work, simply because the condition does not evaluate to a scalar (that is, a single value).

On the other hand,

=SUMPRODUCT((MONTH(date-range)=4)+0)

will give you the desired count of dates falling in April.

You can also put 4 in a cell of its own and use that cell's ref in the above formula.

If interested, you can find many threads in the archives of the old board, involving multiconditional counting and summing.

Aladin
Aladin Akyurek is offline   Reply With Quote
Old May 20th, 2002, 03:19 PM   #10
golszews
New Member
 
Join Date: May 2002
Posts: 5
Default

Aladin

Thankyou immensly. At last, it is working! Could you possibly let me know how I could include a particular year? For instance if my set of data spanned a 5 year period, and I only needed April 2002.

Thanx again
gosia
golszews 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 11:48 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