Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default multiple criteria date range

I'm trying to countif in 2 columns 1has "O" or "MV". The other column has
date ranges.
So if dates 1/1/1985 -12/31/1985 "O" count how many. And do the same for
"MV" within the same date range. Here is the formula im using. Not sure if
I'm on the right track. It 's not working....
=COUNT(IF((G2:G1238="O")*(H2:H1238<12/31/1985)*(H2:H12381/1/1985),H2:H1238))
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default multiple criteria date range

Hi,

Try it like this

=SUMPRODUCT((G2:G1238="O")*(H2:H1238=DATE(1985,1, 1))*(H2:H1238<=DATE(1985,12,31)))

To make it more 'user friendly' put your lookup values in a cell

=SUMPRODUCT((G2:G1238=A1)*(H2:H1238=A2)*(H2:H1238 <=A3))

Where

A1= o
a2= 1/1/1985
a3= 31/12/1985

That way it's easy to alter the lookup parameters

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Pat318" wrote:

I'm trying to countif in 2 columns 1has "O" or "MV". The other column has
date ranges.
So if dates 1/1/1985 -12/31/1985 "O" count how many. And do the same for
"MV" within the same date range. Here is the formula im using. Not sure if
I'm on the right track. It 's not working....
=COUNT(IF((G2:G1238="O")*(H2:H1238<12/31/1985)*(H2:H12381/1/1985),H2:H1238))

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default multiple criteria date range

Thanks Alot Mike U R a life saver.
Pat318

"Mike H" wrote:

Hi,

Try it like this

=SUMPRODUCT((G2:G1238="O")*(H2:H1238=DATE(1985,1, 1))*(H2:H1238<=DATE(1985,12,31)))

To make it more 'user friendly' put your lookup values in a cell

=SUMPRODUCT((G2:G1238=A1)*(H2:H1238=A2)*(H2:H1238 <=A3))

Where

A1= o
a2= 1/1/1985
a3= 31/12/1985

That way it's easy to alter the lookup parameters

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Pat318" wrote:

I'm trying to countif in 2 columns 1has "O" or "MV". The other column has
date ranges.
So if dates 1/1/1985 -12/31/1985 "O" count how many. And do the same for
"MV" within the same date range. Here is the formula im using. Not sure if
I'm on the right track. It 's not working....
=COUNT(IF((G2:G1238="O")*(H2:H1238<12/31/1985)*(H2:H12381/1/1985),H2:H1238))

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 563
Default multiple criteria date range

Not COUNTIF but SUMPRODUCT
And let's be careful how we refer to dates
=SUMPRODUCT(--(G2:G1238="O"), --(H2:H1238<DATE(1985,12,31)), --(H2:H1238DATE(1985,1,1)))
will count how many records have the O and dates between those specified

To include the first and last date
=SUMPRODUCT(--(G2:G1238="O"), --(H2:H1238<=DATE(1985,12,31)), --(H2:H1238=DATE(1985,1,1))
)

If you want O or MV
=SUMPRODUCT(--((G2:G1238="O")+(G2:G1238="MV")), --(H2:H1238<=DATE(1985,12,31)),
--(H2:H1238=DATE(1985,1,1)) )

The double negation for the first term is not needed
=SUMPRODUCT(((G2:G1238="O")+(G2:G1238="MV")), --(H2:H1238<=DATE(1985,12,31)),
--(H2:H1238=DATE(1985,1,1)) )


More info:
Bob Phillips
http://www.xldynamic.com/source/xld.SUMPRODUCT.html
J.E McGimpsey
http://mcgimpsey.com/excel/formulae/doubleneg.html
Debra Dalgleish
http://www.contextures.com/xlFunctio...tml#SumProduct

best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme


"Pat318" wrote in message
...
I'm trying to countif in 2 columns 1has "O" or "MV". The other column has
date ranges.
So if dates 1/1/1985 -12/31/1985 "O" count how many. And do the same for
"MV" within the same date range. Here is the formula im using. Not sure if
I'm on the right track. It 's not working....
=COUNT(IF((G2:G1238="O")*(H2:H1238<12/31/1985)*(H2:H12381/1/1985),H2:H1238))


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default multiple criteria date range

Glad I could help and thanks for the feedback
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Pat318" wrote:

Thanks Alot Mike U R a life saver.
Pat318

"Mike H" wrote:

Hi,

Try it like this

=SUMPRODUCT((G2:G1238="O")*(H2:H1238=DATE(1985,1, 1))*(H2:H1238<=DATE(1985,12,31)))

To make it more 'user friendly' put your lookup values in a cell

=SUMPRODUCT((G2:G1238=A1)*(H2:H1238=A2)*(H2:H1238 <=A3))

Where

A1= o
a2= 1/1/1985
a3= 31/12/1985

That way it's easy to alter the lookup parameters

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Pat318" wrote:

I'm trying to countif in 2 columns 1has "O" or "MV". The other column has
date ranges.
So if dates 1/1/1985 -12/31/1985 "O" count how many. And do the same for
"MV" within the same date range. Here is the formula im using. Not sure if
I'm on the right track. It 's not working....
=COUNT(IF((G2:G1238="O")*(H2:H1238<12/31/1985)*(H2:H12381/1/1985),H2:H1238))

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
Countif with multiple criteria and date range Pedro Dias Ferreira Excel Worksheet Functions 12 November 13th 09 01:24 PM
Sum multiple criteria with a range than and < than Jan Excel Worksheet Functions 5 March 26th 09 06:38 PM
match multiple criteria ina range from multiple criteria multiplet RG Excel Worksheet Functions 8 September 28th 07 04:21 AM
look up with multiple criteria and within a range kjguillermo Excel Worksheet Functions 3 September 26th 06 12:23 AM
Counting from one range to another range, multiple criteria macamarr Excel Discussion (Misc queries) 3 June 10th 06 11:02 AM


All times are GMT +1. The time now is 07:12 PM.

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

About Us

"It's about Microsoft Excel"