![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 3
|
I have a spreadsheet that has dates in one column formatted as dd/mm/yyyy and I'm trying to count the number of jan, feb, etc. occurances in this spreadsheet. I've used the countif function as so: =COUNTIF(F2:F74;=>"2/1/2002")+COUNTIF(F2:F74;=<"2/28/2002") and get an error result for the formula. I've also tried the sumif function and can't seem to get the right configuration for the formula. Any ideas/concerns/further suggestions would be GREATLY appreciated?
|
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
In H2 enter: =SUMPRODUCT((MONTH($F$2:$F$74)=G2)+0) and copy down as far as needed. [ This Message was edited by: Aladin Akyurek on 2002-04-19 11:50 ] |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Calgary, Alberta Canada
Posts: 2,065
|
The following 2 alternatives work. Note my system is configured to use dd/mm/yy but not separators of ";". =COUNTIF(F2:F7,">=1/1/2002")-COUNTIF(F2:F74,">=31/1/2002") with criteria in D1 and D2 =COUNTIF(F2:F7,">="&D1)-COUNTIF(F2:F74,">="&D2) |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Your errors are caused in part by invalid relational operators...
Use >= instead of => Use <= instead of =< Also, the operator should be included in text string used as COUNTIF's 2nd argument. [ This Message was edited by: Mark W. on 2002-04-19 11:51 ] |
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Quote:
=COUNTIF(F2:F74,">=2/1/2002")
__________________
Regards! Yogi Anand, D.Eng, P.E. Energy Efficient Building Network LLC www.energyefficientbuild.com |
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Apr 2002
Posts: 3
|
Thanks for all the suggestions, here's where I'm at =COUNTIF(F2:F74,">=01/02/02")+COUNTIF(F2:F74,"<=28/02/02") the result is a number which I know to be untrue. It returns a value of 57 and I know there were only 13 occurances in Feb. The same holds true for March and April, the formula returns a number, just not an accurate one.
|
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
I'm guessing that you think your formula is counting the entries between these dates (the intersection), but actually your formula is counting the union -- all of your dates. This array formula would do the trick... {=COUNT(IF(MONTH(F2:F74)=2,1))} Note: Array formulas must be entered using the Control+Shift+Enter key combination. The outermost braces, { }, are not entered by you -- they're supplied by Excel in recognition of a properly entered array formula. [ This Message was edited by: Mark W. on 2002-04-19 14:09 ] |
|
|
|
|
|
|
#8 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Quote:
Depends on what you are trying to compute. The first expression computes the number of all transactions date equal to or greater than 1/2/2002 (which by the way includes all transaction dates covered by your second expression). Are you sure you want to add the two expressions? perhaps you want to subtract them -- we will know wwhether the two expressions should be added or subtracted if you provide a clear statement. HTH |
|
|
|
|
|
|
#9 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
Moreover, your formula should read: =COUNTIF(F2:F74,">=01/02/02")-COUNTIF(F2:F74,">28/02/02") Give also a try to what I already suggested. Another alternative is: In G2 enter and copy down: =MONTH(F2) Then use a straight COUNTIF, e.g., for February: =COUNTIF($G$2:$G$74,2) Aladin [ This Message was edited by: aladin akyurek on 2002-04-20 02:00 ] |
|
|
|
|
|
|
#10 |
|
New Member
Join Date: Apr 2002
Posts: 3
|
GOTCHA! I WAS TRUELY HOPING TO COUNT, BOTH BY MONTH, AND BY THE DATE OF THAT RESPECTIVE MONTH. AHH WELL SUCH AS LIFE.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|