Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kay Kay is offline
external usenet poster
 
Posts: 129
Default Countif with dates for vs 2003

Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong number.
The dates are entered using 1/6/08 and formatted to appear as Jan-08. I want
to count the number of cells that have Jan as a date, etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008") -COUNTIF(Data!F2:F65536,"<=1/31/2008")
The result counts all cells rather than the 50 it should be

=SUM(COUNTIF(F2:F65536,{"12/31/08","<=1/1/09"})) the result is 0

=SUMPRODUCT((MONTH(Data!F2:F65536)=1),(YEAR(Data!F 2:F65536)=2008)) the
result is 0

I am stumped.

Would really appreciate the help!


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Countif with dates for vs 2003

How about:

=COUNTIF(Data!F2:F65536,"=date(2008,1,1))
-COUNTIF(Data!F2:F65536,"<=date(2008,1,31))

Or
=COUNTIF(Data!F:F,"=date(2008,1,1))
-COUNTIF(Data!F:F,"<=date(2008,1,31))

(I bet you don't have a date in F1)

=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))
or
=SUMPRODUCT(text(Data!F2:F65536,"yyyymm")="200801" )

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html


Kay wrote:

Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong number.
The dates are entered using 1/6/08 and formatted to appear as Jan-08. I want
to count the number of cells that have Jan as a date, etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008") -COUNTIF(Data!F2:F65536,"<=1/31/2008")
The result counts all cells rather than the 50 it should be

=SUM(COUNTIF(F2:F65536,{"12/31/08","<=1/1/09"})) the result is 0

=SUMPRODUCT((MONTH(Data!F2:F65536)=1),(YEAR(Data!F 2:F65536)=2008)) the
result is 0

I am stumped.

Would really appreciate the help!


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default Countif with dates for vs 2003

Kay wrote:
Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong number.
The dates are entered using 1/6/08 and formatted to appear as Jan-08. I want
to count the number of cells that have Jan as a date, etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008") -COUNTIF(Data!F2:F65536,"<=1/31/2008")
The result counts all cells rather than the 50 it should be


Shouldn't the "<=" also be "="?


=SUM(COUNTIF(F2:F65536,{"12/31/08","<=1/1/09"})) the result is 0

=SUMPRODUCT((MONTH(Data!F2:F65536)=1),(YEAR(Data!F 2:F65536)=2008)) the
result is 0

I am stumped.

Would really appreciate the help!


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default Countif with dates for vs 2003

Glenn wrote:
Kay wrote:
Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong
number. The dates are entered using 1/6/08 and formatted to appear as
Jan-08. I want to count the number of cells that have Jan as a date,
etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008")
-COUNTIF(Data!F2:F65536,"<=1/31/2008") The result counts all cells
rather than the 50 it should be


Shouldn't the "<=" also be "="?



Also, as pointed out by Dave Peterson, use DATE(year,month,day).

= COUNTIF(Data!F2:F65536,"="&DATE(2008,1,1)) -
COUNTIF(Data!F2:F65536,"="&DATE(2008,1,31))
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kay Kay is offline
external usenet poster
 
Posts: 129
Default Countif with dates for vs 2003

DAve,

The first sumproduct example you gave me worked fine so thanks so much, but
I would l ike to understand why the examples I sent you did not work.
"Dave Peterson" wrote:

How about:

=COUNTIF(Data!F2:F65536,"=date(2008,1,1))
-COUNTIF(Data!F2:F65536,"<=date(2008,1,31))

Or
=COUNTIF(Data!F:F,"=date(2008,1,1))
-COUNTIF(Data!F:F,"<=date(2008,1,31))

(I bet you don't have a date in F1)

=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))
or
=SUMPRODUCT(text(Data!F2:F65536,"yyyymm")="200801" )

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html


Kay wrote:

Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong number.
The dates are entered using 1/6/08 and formatted to appear as Jan-08. I want
to count the number of cells that have Jan as a date, etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008") -COUNTIF(Data!F2:F65536,"<=1/31/2008")
The result counts all cells rather than the 50 it should be

=SUM(COUNTIF(F2:F65536,{"12/31/08","<=1/1/09"})) the result is 0

=SUMPRODUCT((MONTH(Data!F2:F65536)=1),(YEAR(Data!F 2:F65536)=2008)) the
result is 0

I am stumped.

Would really appreciate the help!


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Countif with dates for vs 2003

I'd guess that stuff like this:
1/1/08
is seen as
1 divided by 1 divided by 8

Not as a real date.

Kay wrote:

DAve,

The first sumproduct example you gave me worked fine so thanks so much, but
I would l ike to understand why the examples I sent you did not work.
"Dave Peterson" wrote:

How about:

=COUNTIF(Data!F2:F65536,"=date(2008,1,1))
-COUNTIF(Data!F2:F65536,"<=date(2008,1,31))

Or
=COUNTIF(Data!F:F,"=date(2008,1,1))
-COUNTIF(Data!F:F,"<=date(2008,1,31))

(I bet you don't have a date in F1)

=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))
or
=SUMPRODUCT(text(Data!F2:F65536,"yyyymm")="200801" )

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html


Kay wrote:

Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong number.
The dates are entered using 1/6/08 and formatted to appear as Jan-08. I want
to count the number of cells that have Jan as a date, etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008") -COUNTIF(Data!F2:F65536,"<=1/31/2008")
The result counts all cells rather than the 50 it should be

=SUM(COUNTIF(F2:F65536,{"12/31/08","<=1/1/09"})) the result is 0

=SUMPRODUCT((MONTH(Data!F2:F65536)=1),(YEAR(Data!F 2:F65536)=2008)) the
result is 0

I am stumped.

Would really appreciate the help!


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kay Kay is offline
external usenet poster
 
Posts: 129
Default Countif with dates for vs 2003

DAve,
Your explanation makes sense. thanks, but let me pick your genius brain one
more time. If I find my answer using your solution of how many people were
hired as contractors,
=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008)) how
would i then find out how many of those were converted to permanent employees
in the same date range. They might be hired as a contractor and stay that
way for several months or they could be permanently hired within the same
month. I tried
=(SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))-SUMPRODUCT(--(MONTH(Data!G2:G65536)=1),--(YEAR(Data!G2:G65536)=2008)))
but get the wrong answer.

"Dave Peterson" wrote:

I'd guess that stuff like this:
1/1/08
is seen as
1 divided by 1 divided by 8

Not as a real date.

Kay wrote:

DAve,

The first sumproduct example you gave me worked fine so thanks so much, but
I would l ike to understand why the examples I sent you did not work.
"Dave Peterson" wrote:

How about:

=COUNTIF(Data!F2:F65536,"=date(2008,1,1))
-COUNTIF(Data!F2:F65536,"<=date(2008,1,31))

Or
=COUNTIF(Data!F:F,"=date(2008,1,1))
-COUNTIF(Data!F:F,"<=date(2008,1,31))

(I bet you don't have a date in F1)

=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))
or
=SUMPRODUCT(text(Data!F2:F65536,"yyyymm")="200801" )

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html


Kay wrote:

Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong number.
The dates are entered using 1/6/08 and formatted to appear as Jan-08. I want
to count the number of cells that have Jan as a date, etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008") -COUNTIF(Data!F2:F65536,"<=1/31/2008")
The result counts all cells rather than the 50 it should be

=SUM(COUNTIF(F2:F65536,{"12/31/08","<=1/1/09"})) the result is 0

=SUMPRODUCT((MONTH(Data!F2:F65536)=1),(YEAR(Data!F 2:F65536)=2008)) the
result is 0

I am stumped.

Would really appreciate the help!

--

Dave Peterson


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Countif with dates for vs 2003

First, I would check to see if this variation of your formula:
=SUMPRODUCT(--(text(Data!F2:F65536,"yyyymm")="200801"))
counted the number of contractors hired in Jan of 2008.

And this
=SUMPRODUCT(--(text(data!G2:G65536,"yyyymm")="200801"))
counted the number of permanent employees that started in Jan of 2008.

I think this formula is easier to read, but will be equivalent to each portion
in your original formula.

And as an aside, if you can pick a smaller number of rows to check, your
calculation times will be better.

But I'm not sure doing the subtraction will get you what you want. If I was
hired as a contractor in August of 1967 and made permanent in January of 2008,
then I'll be counted in that second formula.

If you want to limit your count to just the people hired as contractors in Jan
2008 and converted to permanent employees in Jan of 2008, I think just adding
more conditions to the =sumproduct() should work:

=SUMPRODUCT(--(text(Data!F2:F65536,"yyyymm")="200801"),
--(text(data!G2:G65536,"yyyymm")="200801"))

Both of these conditions have to be true for it to be counted.


Kay wrote:

DAve,
Your explanation makes sense. thanks, but let me pick your genius brain one
more time. If I find my answer using your solution of how many people were
hired as contractors,
=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008)) how
would i then find out how many of those were converted to permanent employees
in the same date range. They might be hired as a contractor and stay that
way for several months or they could be permanently hired within the same
month. I tried
=(SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))-SUMPRODUCT(--(MONTH(Data!G2:G65536)=1),--(YEAR(Data!G2:G65536)=2008)))
but get the wrong answer.

"Dave Peterson" wrote:

I'd guess that stuff like this:
1/1/08
is seen as
1 divided by 1 divided by 8

Not as a real date.

Kay wrote:

DAve,

The first sumproduct example you gave me worked fine so thanks so much, but
I would l ike to understand why the examples I sent you did not work.
"Dave Peterson" wrote:

How about:

=COUNTIF(Data!F2:F65536,"=date(2008,1,1))
-COUNTIF(Data!F2:F65536,"<=date(2008,1,31))

Or
=COUNTIF(Data!F:F,"=date(2008,1,1))
-COUNTIF(Data!F:F,"<=date(2008,1,31))

(I bet you don't have a date in F1)

=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))
or
=SUMPRODUCT(text(Data!F2:F65536,"yyyymm")="200801" )

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html


Kay wrote:

Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong number.
The dates are entered using 1/6/08 and formatted to appear as Jan-08. I want
to count the number of cells that have Jan as a date, etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008") -COUNTIF(Data!F2:F65536,"<=1/31/2008")
The result counts all cells rather than the 50 it should be

=SUM(COUNTIF(F2:F65536,{"12/31/08","<=1/1/09"})) the result is 0

=SUMPRODUCT((MONTH(Data!F2:F65536)=1),(YEAR(Data!F 2:F65536)=2008)) the
result is 0

I am stumped.

Would really appreciate the help!

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kay Kay is offline
external usenet poster
 
Posts: 129
Default Countif with dates for vs 2003

Dave,

Once again thanks. That did simplify the problem because when I tried
adding other conditions to the first version, it was just to complex.

I really appreciate it.



"Dave Peterson" wrote:

First, I would check to see if this variation of your formula:
=SUMPRODUCT(--(text(Data!F2:F65536,"yyyymm")="200801"))
counted the number of contractors hired in Jan of 2008.

And this
=SUMPRODUCT(--(text(data!G2:G65536,"yyyymm")="200801"))
counted the number of permanent employees that started in Jan of 2008.

I think this formula is easier to read, but will be equivalent to each portion
in your original formula.

And as an aside, if you can pick a smaller number of rows to check, your
calculation times will be better.

But I'm not sure doing the subtraction will get you what you want. If I was
hired as a contractor in August of 1967 and made permanent in January of 2008,
then I'll be counted in that second formula.

If you want to limit your count to just the people hired as contractors in Jan
2008 and converted to permanent employees in Jan of 2008, I think just adding
more conditions to the =sumproduct() should work:

=SUMPRODUCT(--(text(Data!F2:F65536,"yyyymm")="200801"),
--(text(data!G2:G65536,"yyyymm")="200801"))

Both of these conditions have to be true for it to be counted.


Kay wrote:

DAve,
Your explanation makes sense. thanks, but let me pick your genius brain one
more time. If I find my answer using your solution of how many people were
hired as contractors,
=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008)) how
would i then find out how many of those were converted to permanent employees
in the same date range. They might be hired as a contractor and stay that
way for several months or they could be permanently hired within the same
month. I tried
=(SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))-SUMPRODUCT(--(MONTH(Data!G2:G65536)=1),--(YEAR(Data!G2:G65536)=2008)))
but get the wrong answer.

"Dave Peterson" wrote:

I'd guess that stuff like this:
1/1/08
is seen as
1 divided by 1 divided by 8

Not as a real date.

Kay wrote:

DAve,

The first sumproduct example you gave me worked fine so thanks so much, but
I would l ike to understand why the examples I sent you did not work.
"Dave Peterson" wrote:

How about:

=COUNTIF(Data!F2:F65536,"=date(2008,1,1))
-COUNTIF(Data!F2:F65536,"<=date(2008,1,31))

Or
=COUNTIF(Data!F:F,"=date(2008,1,1))
-COUNTIF(Data!F:F,"<=date(2008,1,31))

(I bet you don't have a date in F1)

=SUMPRODUCT(--(MONTH(Data!F2:F65536)=1),--(YEAR(Data!F2:F65536)=2008))
or
=SUMPRODUCT(text(Data!F2:F65536,"yyyymm")="200801" )

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html


Kay wrote:

Hello all,

I have looked through the archives and have seen several formulas that
should work in my spreadsheet, but return either a 0 or the wrong number.
The dates are entered using 1/6/08 and formatted to appear as Jan-08. I want
to count the number of cells that have Jan as a date, etc.

I have tried the following:
=COUNTIF(Data!F2:F65536,"=1/1/2008") -COUNTIF(Data!F2:F65536,"<=1/31/2008")
The result counts all cells rather than the 50 it should be

=SUM(COUNTIF(F2:F65536,{"12/31/08","<=1/1/09"})) the result is 0

=SUMPRODUCT((MONTH(Data!F2:F65536)=1),(YEAR(Data!F 2:F65536)=2008)) the
result is 0

I am stumped.

Would really appreciate the help!

--

Dave Peterson


--

Dave Peterson


--

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
Countif and dates Tom Excel Worksheet Functions 4 February 14th 08 06:13 PM
Countif between two dates AOP Excel Discussion (Misc queries) 3 November 11th 07 05:05 PM
CountIF with dates Secret Squirrel Excel Discussion (Misc queries) 13 November 15th 06 09:08 PM
using countif to add dates jwmillzy Excel Discussion (Misc queries) 2 June 2nd 06 06:27 PM
Countif using dates Bugaglugs Excel Worksheet Functions 11 August 23rd 05 05:16 PM


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