Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 40
Default Count between two dates using sumproduct

Using Excel 2003, A5:A1000 is a range of dates covering 12 months, 1/1/10
through 12/31/10; E5:E1000 is a range of names, ie Smith. I need to count the
number of times Smith occurs for each month, ie January, February, etc. I
have the following formula,
{=SUMPRODUCT(--(A5:A1000=1/1/2010),--(A5:A1000<=1/31/2010),--(E5:E1000)="Smith")}, but am getting a value error. What am I missing?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Count between two dates using sumproduct

Try this amendment, normal ENTER will do:
=SUMPRODUCT(--(A5:A10=--"1/1/2010"),--(A5:A10<=--"1/31/2010"),--(E5:E10="Smith"))
Success? wave it, hit YES below
--
Max
Singapore
---
"Basenji" wrote:
Using Excel 2003, A5:A1000 is a range of dates covering 12 months, 1/1/10
through 12/31/10; E5:E1000 is a range of names, ie Smith. I need to count the
number of times Smith occurs for each month, ie January, February, etc. I
have the following formula,
{=SUMPRODUCT(--(A5:A1000=1/1/2010),--(A5:A1000<=1/31/2010),--(E5:E1000)="Smith")}, but am getting a value error. What am I missing?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Count between two dates using sumproduct

What am I missing?

Well, for one thing, I explained in your other post why you shouldn't use
these expressions:

A5:A1000=1/1/2010
A5:A1000<=1/31/2010

am getting a value error.


After reading your reply in the other post I'm thinking that your dates
(either all of them or some of them) aren't true Excel dates.

Does every cell in this range, A5:A1000, contain a date? If so, and if
they're true Excel dates then this formula:

=COUNT(A5:A1000)

Should return 996

--
Biff
Microsoft Excel MVP


"Basenji" wrote in message
...
Using Excel 2003, A5:A1000 is a range of dates covering 12 months, 1/1/10
through 12/31/10; E5:E1000 is a range of names, ie Smith. I need to count
the
number of times Smith occurs for each month, ie January, February, etc. I
have the following formula,
{=SUMPRODUCT(--(A5:A1000=1/1/2010),--(A5:A1000<=1/31/2010),--(E5:E1000)="Smith")},
but am getting a value error. What am I missing?



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Count between two dates using sumproduct

Here's the original post:

http://www.microsoft.com/communities...1-3a435a6eb019

--
Biff
Microsoft Excel MVP


"Max" wrote in message
...
Try this amendment, normal ENTER will do:
=SUMPRODUCT(--(A5:A10=--"1/1/2010"),--(A5:A10<=--"1/31/2010"),--(E5:E10="Smith"))
Success? wave it, hit YES below
--
Max
Singapore
---
"Basenji" wrote:
Using Excel 2003, A5:A1000 is a range of dates covering 12 months, 1/1/10
through 12/31/10; E5:E1000 is a range of names, ie Smith. I need to count
the
number of times Smith occurs for each month, ie January, February, etc. I
have the following formula,
{=SUMPRODUCT(--(A5:A1000=1/1/2010),--(A5:A1000<=1/31/2010),--(E5:E1000)="Smith")},
but am getting a value error. What am I missing?



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 905
Default Count between two dates using sumproduct

"Basenji" wrote:
I have the following formula,
{=SUMPRODUCT(--(A5:A1000=1/1/2010),
--(A5:A1000<=1/31/2010),--(E5:E1000)="Smith")},
but am getting a value error. What am I missing?


The #VALUE error is caused by the incorrect placement of parentheses in the
last argument. But your formula will still have unexpected results.

At a minimum, you should write:

=SUMPRODUCT(--(A5:A1000=--"1/1/2010"),
--(A5:A1000<=--"1/31/2010"),--(E5:E1000="Smith"))

This assumes that the dates in A5:A1000 are bona fide date numbers, not
text. The syntax --"1/1/2010" converts the date string to a date number;
otherwise, you are computing 1 divided by 1 divided by 2010. Also note the
placement of parentheses in the last argument.

Although that might work for you, it depends on your Regional and Language
settings. It would be better to write:

=SUMPRODUCT(--(A5:A1000=DATE(2010,1,1)),
--(A5:A1000<=DATE(2010,1,31),--(E5:E1000="Smith"))

However, that still requires that you customize 12 different formulas. For
a more robust design, put the dates 1/1/2010, 2/1/2010 etc into a column, say
B1:B12, formatted with the Custom format "mmm" without quotes. Then in a
parallel column, say C1:C12, put the following formula into C1 and copy down:

=SUMPRODUCT(--(MONTH(A5:A1000)=MONTH(B1),
--(E5:E1000="Smith"))

or more simply:

=SUMPRODUCT((MONTH(A5:A1000)=MONTH(C1)
*(E5:E1000="Smith"))

This assumes that the dates in A5:A1000 are all in the same year, or at
least one 12-month period, as you stipulated originally.


----- original message -----

"Basenji" wrote:
Using Excel 2003, A5:A1000 is a range of dates covering 12 months, 1/1/10
through 12/31/10; E5:E1000 is a range of names, ie Smith. I need to count the
number of times Smith occurs for each month, ie January, February, etc. I
have the following formula,
{=SUMPRODUCT(--(A5:A1000=1/1/2010),--(A5:A1000<=1/31/2010),--(E5:E1000)="Smith")}, but am getting a value error. What am I missing?



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Count between two dates using sumproduct

I would use the =date() function:

=SUMPRODUCT(--(A5:A1000=date(2010,1,1)),
--(A5:A1000<=date(2010,1,31)),
--(E5:E1000="Smith"))

(watch your parentheses around that last portion)

(you don't need to array enter it either.)

And if you really wanted to check for a complete month:

=SUMPRODUCT(--(text(A5:A1000,"yyyymm")="201001"),
--(E5:E1000="Smith"))


Basenji wrote:

Using Excel 2003, A5:A1000 is a range of dates covering 12 months, 1/1/10
through 12/31/10; E5:E1000 is a range of names, ie Smith. I need to count the
number of times Smith occurs for each month, ie January, February, etc. I
have the following formula,
{=SUMPRODUCT(--(A5:A1000=1/1/2010),--(A5:A1000<=1/31/2010),--(E5:E1000)="Smith")}, but am getting a value error. What am I missing?


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Count between two dates using sumproduct

Thanks for the link. Looks like it was effort wasted here, then.
--
Max
Singapore
---
"T. Valko" wrote:
Here's the original post:

http://www.microsoft.com/communities...1-3a435a6eb019


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count Dates between Dates exclude Text Ken Excel Discussion (Misc queries) 3 April 8th 09 07:59 PM
Sumproduct count between dates for specific day Hud67 Excel Discussion (Misc queries) 7 May 17th 08 08:44 PM
I want to count the total Number of dates between two dates How? seshu Excel Worksheet Functions 3 February 7th 08 05:41 PM
Sumproduct to get a count of dates Anurag Excel Discussion (Misc queries) 0 November 13th 07 03:18 PM
need to convert list of dates to count no. of dates by week neowok Excel Worksheet Functions 13 January 30th 06 03:54 PM


All times are GMT +1. The time now is 12:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"