Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default COUNTIF: 2 criteria: Date Range Column & Text Column

Sounds like a job for SUMPRODUCT but note you cannot reference the
entire column using this function.

Assume that A1 is the date you are using as criteria and A2 is the
value you are trying to find in Col F.

=SUMPRODUCT(--(C1:C10=A1)*(--(F1:F10=A2)))

How does this work? C1:C10=A1 creates an array of ten TRUE or FALSE
values where the "--" turns them into 1 for TRUE and 0 for FALSE.
F1:F10=A2 does the same for the other range. SUMPRODUCT multiples each
pair of 1's and 0's then adds them up. So if the first pair (C1 and
F1) evaluate as FALSE and TRUE, the results is 0 x 1 or 0. If the
second pair are both TRUE the result would be 1 x 1 or 1. Add up all
of the ones and you'll have your count.

- John
www.JohnMichl.com

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
MAC
 
Posts: n/a
Default COUNTIF: 2 criteria: Date Range Column & Text Column

Hey John, see Bob's solution below - you can reference the entire column.

MAC

"John Michl" wrote:

Sounds like a job for SUMPRODUCT but note you cannot reference the
entire column using this function.

Assume that A1 is the date you are using as criteria and A2 is the
value you are trying to find in Col F.

=SUMPRODUCT(--(C1:C10=A1)*(--(F1:F10=A2)))

How does this work? C1:C10=A1 creates an array of ten TRUE or FALSE
values where the "--" turns them into 1 for TRUE and 0 for FALSE.
F1:F10=A2 does the same for the other range. SUMPRODUCT multiples each
pair of 1's and 0's then adds them up. So if the first pair (C1 and
F1) evaluate as FALSE and TRUE, the results is 0 x 1 or 0. If the
second pair are both TRUE the result would be 1 x 1 or 1. Add up all
of the ones and you'll have your count.

- John
www.JohnMichl.com


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default COUNTIF: 2 criteria: Date Range Column & Text Column

Bob is not referencing the entire column he is referencing the range
from row 2 through row 200. The entire column would be represented by
$C:$C. This is not permitted in SUMPRODUCT.

- John

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Scott Lolmaugh
 
Posts: n/a
Default COUNTIF date falls within a certain month

I have a similar problem but I am not familiar with SUMPRODUCT.
I have a range of dates and I want to get a count of cells by month. (How
many January, February, etc.)

So, if A1:A5 is

1/2/2006
2/2/2006
3/2/2006
3/5/2006
4/2/2006


....and if I'm looking for the number of dates in March I want to...

COUNTIF(A1:A5, = "3/1/2006" AND < "4/1/2006")

(...but of course this formula doesn't work.)

So, how would I do it?

Thanks,
Scott

"John Michl" wrote in message
oups.com...
Sounds like a job for SUMPRODUCT but note you cannot reference the
entire column using this function.

Assume that A1 is the date you are using as criteria and A2 is the
value you are trying to find in Col F.

=SUMPRODUCT(--(C1:C10=A1)*(--(F1:F10=A2)))

How does this work? C1:C10=A1 creates an array of ten TRUE or FALSE
values where the "--" turns them into 1 for TRUE and 0 for FALSE.
F1:F10=A2 does the same for the other range. SUMPRODUCT multiples each
pair of 1's and 0's then adds them up. So if the first pair (C1 and
F1) evaluate as FALSE and TRUE, the results is 0 x 1 or 0. If the
second pair are both TRUE the result would be 1 x 1 or 1. Add up all
of the ones and you'll have your count.

- John
www.JohnMichl.com



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default COUNTIF date falls within a certain month

=countif(a1:a5,"="&date(2006,3,1)) - countif(a1:a5,"="&date(2006,4,1))

is one way.

Scott Lolmaugh wrote:

I have a similar problem but I am not familiar with SUMPRODUCT.
I have a range of dates and I want to get a count of cells by month. (How
many January, February, etc.)

So, if A1:A5 is

1/2/2006
2/2/2006
3/2/2006
3/5/2006
4/2/2006

...and if I'm looking for the number of dates in March I want to...

COUNTIF(A1:A5, = "3/1/2006" AND < "4/1/2006")

(...but of course this formula doesn't work.)

So, how would I do it?

Thanks,
Scott

"John Michl" wrote in message
oups.com...
Sounds like a job for SUMPRODUCT but note you cannot reference the
entire column using this function.

Assume that A1 is the date you are using as criteria and A2 is the
value you are trying to find in Col F.

=SUMPRODUCT(--(C1:C10=A1)*(--(F1:F10=A2)))

How does this work? C1:C10=A1 creates an array of ten TRUE or FALSE
values where the "--" turns them into 1 for TRUE and 0 for FALSE.
F1:F10=A2 does the same for the other range. SUMPRODUCT multiples each
pair of 1's and 0's then adds them up. So if the first pair (C1 and
F1) evaluate as FALSE and TRUE, the results is 0 x 1 or 0. If the
second pair are both TRUE the result would be 1 x 1 or 1. Add up all
of the ones and you'll have your count.

- John
www.JohnMichl.com


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SteveG
 
Posts: n/a
Default COUNTIF: 2 criteria: Date Range Column & Text Column


Jeremy,

=SUMPRODUCT(--(AX2:AX61="OPEN"),--(B2:B61=DATE(2005,10,1)),--(B2:B61<=DATE(2005,12,31)))

or put your reference dates in two other cells say F1 & G1

=SUMPRODUCT(--(AX1:AX20="OPEN"),--(B1:B20=F1),--(B1:B20<=G1))

or don't use the "--" at all

=SUMPRODUCT((AX1:AX20="OPEN")*(B1:B20=F1)*(B1:B20 <=G1))

You were putting the "--" after the = sign in your conditions, this is
not necessary. Also, having the dates in " " doesn't seem to work
either.

HTH

Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=491906

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SteveG
 
Posts: n/a
Default COUNTIF: 2 criteria: Date Range Column & Text Column


Jeremy,

Sorry, forgot to change the ranges.

=SUMPRODUCT((AX2:AX61="OPEN")*(B2:B61=F1)*(B2:B61 <=G1))

Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=491906

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Scott Lolmaugh
 
Posts: n/a
Default COUNTIF date falls within a certain month

Perfect! Works like a charm.
Thanks!!
Scott

"Dave Peterson" wrote in message
...
=countif(a1:a5,"="&date(2006,3,1)) - countif(a1:a5,"="&date(2006,4,1))

is one way.

Scott Lolmaugh wrote:

I have a similar problem but I am not familiar with SUMPRODUCT.
I have a range of dates and I want to get a count of cells by month.
(How
many January, February, etc.)

So, if A1:A5 is

1/2/2006
2/2/2006
3/2/2006
3/5/2006
4/2/2006

...and if I'm looking for the number of dates in March I want to...

COUNTIF(A1:A5, = "3/1/2006" AND < "4/1/2006")

(...but of course this formula doesn't work.)

So, how would I do it?

Thanks,
Scott

"John Michl" wrote in message
oups.com...
Sounds like a job for SUMPRODUCT but note you cannot reference the
entire column using this function.

Assume that A1 is the date you are using as criteria and A2 is the
value you are trying to find in Col F.

=SUMPRODUCT(--(C1:C10=A1)*(--(F1:F10=A2)))

How does this work? C1:C10=A1 creates an array of ten TRUE or FALSE
values where the "--" turns them into 1 for TRUE and 0 for FALSE.
F1:F10=A2 does the same for the other range. SUMPRODUCT multiples each
pair of 1's and 0's then adds them up. So if the first pair (C1 and
F1) evaluate as FALSE and TRUE, the results is 0 x 1 or 0. If the
second pair are both TRUE the result would be 1 x 1 or 1. Add up all
of the ones and you'll have your count.

- John
www.JohnMichl.com


--

Dave Peterson



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
Help PLEASE! Not sure what answer is: Match? Index? Other? baz Excel Worksheet Functions 7 September 3rd 05 03:47 PM
Value between 2 dates AG Excel Worksheet Functions 11 August 21st 05 05:32 PM
Formulas dealing with text data Bagia Excel Worksheet Functions 6 June 20th 05 10:29 PM
I need a formula to find rows within a date range in one column? M. Penney Excel Worksheet Functions 5 May 12th 05 12:32 AM
use a date range as criteria in a countif formula mbparks Excel Worksheet Functions 3 January 2nd 05 11:06 PM


All times are GMT +1. The time now is 07:46 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"