#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default Excel Formula

Looking for just a basic formula to count between number or dates. Ex.
count between 1/2/2007 thru 1/31/07. I couldn't find anything in help
file.They show
or < ??

Any help would be appriciated

Steve
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 284
Default Excel Formula

It's just a subtraction problem. "=b1-a1" for example. Then you will want
to format the cell where the formula is to show a number and the result will
be the number of days between the two dates.

Steve



"Steve" wrote in message
...
Looking for just a basic formula to count between number or dates. Ex.
count between 1/2/2007 thru 1/31/07. I couldn't find anything in help
file.They show
or < ??

Any help would be appriciated

Steve



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Excel Formula

Use Datedif:

=DATEDIF(A1,A2,"md")+1

--
Gary's Student
gsnu200703


"Steve" wrote:

Looking for just a basic formula to count between number or dates. Ex.
count between 1/2/2007 thru 1/31/07. I couldn't find anything in help
file.They show
or < ??

Any help would be appriciated

Steve

  #4   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Excel Formula

Assuming your dates are in column A

=COUNTIF(A:A,"<=1/31/07")-COUNTIF(A:A,"<1/2/07")

Vaya con Dios,
Chuck, CABGx3




"Steve" wrote in message
...
Looking for just a basic formula to count between number or dates. Ex.
count between 1/2/2007 thru 1/31/07. I couldn't find anything in help
file.They show
or < ??

Any help would be appriciated

Steve



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,118
Default Excel Formula

If you're starting with a list of dates and you want to know how many are
within the range 01/02/2007 through 01/31/2007 (inclusive),
you'll probably get SUMPRODUCT responses,
but lately I've developed a new respect for the FREQUENCY function as an
alternative.

With
A1:A100 containing dates

Try this...
B1: (the end date of the prev range....eg 01/01/2007)
C1: (the end date of the range you want....eg 01/31/2007)

This formula returns the number of cells in A1:A100 that are within the
range 01/02/2007 and 01/31/2007, inclusive.

E1: =INDEX(FREQUENCY(A1:A100,C1:D1),2)

It works this way....

A1:A100 is the list of dates

C1:D1 contains these dates
01/01/2007
01/31/2007

The FREQUENCY function returns an array of 3 values (in this case):
The number of cells that are <=01/01/2007
The number of cells that are 01/01/2007 and <=01/01/2007
The number of cells that are 01/31/2007
(you don't have to specify the last range...Excel assumes it's there and
uses it)

The INDEX function looks at array of 3 values and pulls the 2nd value

Example:
If A1:A100 only contains the list of dates from
12/15/2006 through 02/15/2007,
the FREQUENCY function returns this array: {18,30,15}
which is....
the 18 days prior to 01/02/2007,
the 30 days within 01/02/2007 thru 01/31/2007,
and the 15 days after 01/31/2007

In the example....the formula returns 30

You could also write the formula this way:
=INDEX(FREQUENCY(A1:A100,--{"01-Jan-2007","31-Jan-2007"}),2)

Does that help?

Post back with more questions.

***********
Regards,
Ron

XL2002, WinXP


"Steve" wrote:

Looking for just a basic formula to count between number or dates. Ex.
count between 1/2/2007 thru 1/31/07. I couldn't find anything in help
file.They show
or < ??

Any help would be appriciated

Steve



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Excel Formula

=sumproduct((a2:a22=b1)*(a2:a22<b2))

--
Don Guillett
SalesAid Software

"Steve" wrote in message
...
Looking for just a basic formula to count between number or dates. Ex.
count between 1/2/2007 thru 1/31/07. I couldn't find anything in help
file.They show
or < ??

Any help would be appriciated

Steve



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 620
Default Excel Formula

But be aware that the "md" will give results which may be confusing when you
go beyond a month.
--
David Biddulph

"Gary''s Student" wrote in message
...
Use Datedif:

=DATEDIF(A1,A2,"md")+1


"Steve" wrote:

Looking for just a basic formula to count between number or dates. Ex.
count between 1/2/2007 thru 1/31/07. I couldn't find anything in help
file.They show
or < ??

Any help would be appriciated

Steve



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Excel Formula

Yet another clever idea!

Just a thought......

It may be more intuitive to use the intended date range and adjust in the
formula:

B1 = 01/02/2007
C1 = 01/31/2007

=INDEX(FREQUENCY(A1:A100,B1:C1-{1,0}),2)

We know that Countif(.....)-Countif(.....) is more efficient than the
Sumproduct version. I'm wondering if this Frequency version might be more
efficient than the Countif version?

Biff

"Ron Coderre" wrote in message
...
If you're starting with a list of dates and you want to know how many are
within the range 01/02/2007 through 01/31/2007 (inclusive),
you'll probably get SUMPRODUCT responses,
but lately I've developed a new respect for the FREQUENCY function as an
alternative.

With
A1:A100 containing dates

Try this...
B1: (the end date of the prev range....eg 01/01/2007)
C1: (the end date of the range you want....eg 01/31/2007)

This formula returns the number of cells in A1:A100 that are within the
range 01/02/2007 and 01/31/2007, inclusive.

E1: =INDEX(FREQUENCY(A1:A100,C1:D1),2)

It works this way....

A1:A100 is the list of dates

C1:D1 contains these dates
01/01/2007
01/31/2007

The FREQUENCY function returns an array of 3 values (in this case):
The number of cells that are <=01/01/2007
The number of cells that are 01/01/2007 and <=01/01/2007
The number of cells that are 01/31/2007
(you don't have to specify the last range...Excel assumes it's there and
uses it)

The INDEX function looks at array of 3 values and pulls the 2nd value

Example:
If A1:A100 only contains the list of dates from
12/15/2006 through 02/15/2007,
the FREQUENCY function returns this array: {18,30,15}
which is....
the 18 days prior to 01/02/2007,
the 30 days within 01/02/2007 thru 01/31/2007,
and the 15 days after 01/31/2007

In the example....the formula returns 30

You could also write the formula this way:
=INDEX(FREQUENCY(A1:A100,--{"01-Jan-2007","31-Jan-2007"}),2)

Does that help?

Post back with more questions.

***********
Regards,
Ron

XL2002, WinXP


"Steve" wrote:

Looking for just a basic formula to count between number or dates. Ex.
count between 1/2/2007 thru 1/31/07. I couldn't find anything in help
file.They show
or < ??

Any help would be appriciated

Steve



  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,118
Default Excel Formula

Not sure about the "more intuititive" part...
Since FREQUENCY is already on the fringes of arcane, I thought it would be
easier to explain how the "bins" work without tweaking the inputs with an
array constant and having to explain how THAT works, too!

***********
Regards,
Ron

XL2002, WinXP


"T. Valko" wrote:

Yet another clever idea!

Just a thought......

It may be more intuitive to use the intended date range and adjust in the
formula:

B1 = 01/02/2007
C1 = 01/31/2007

=INDEX(FREQUENCY(A1:A100,B1:C1-{1,0}),2)

We know that Countif(.....)-Countif(.....) is more efficient than the
Sumproduct version. I'm wondering if this Frequency version might be more
efficient than the Countif version?

Biff

"Ron Coderre" wrote in message
...
If you're starting with a list of dates and you want to know how many are
within the range 01/02/2007 through 01/31/2007 (inclusive),
you'll probably get SUMPRODUCT responses,
but lately I've developed a new respect for the FREQUENCY function as an
alternative.

With
A1:A100 containing dates

Try this...
B1: (the end date of the prev range....eg 01/01/2007)
C1: (the end date of the range you want....eg 01/31/2007)

This formula returns the number of cells in A1:A100 that are within the
range 01/02/2007 and 01/31/2007, inclusive.

E1: =INDEX(FREQUENCY(A1:A100,C1:D1),2)

It works this way....

A1:A100 is the list of dates

C1:D1 contains these dates
01/01/2007
01/31/2007

The FREQUENCY function returns an array of 3 values (in this case):
The number of cells that are <=01/01/2007
The number of cells that are 01/01/2007 and <=01/01/2007
The number of cells that are 01/31/2007
(you don't have to specify the last range...Excel assumes it's there and
uses it)

The INDEX function looks at array of 3 values and pulls the 2nd value

Example:
If A1:A100 only contains the list of dates from
12/15/2006 through 02/15/2007,
the FREQUENCY function returns this array: {18,30,15}
which is....
the 18 days prior to 01/02/2007,
the 30 days within 01/02/2007 thru 01/31/2007,
and the 15 days after 01/31/2007

In the example....the formula returns 30

You could also write the formula this way:
=INDEX(FREQUENCY(A1:A100,--{"01-Jan-2007","31-Jan-2007"}),2)

Does that help?

Post back with more questions.

***********
Regards,
Ron

XL2002, WinXP


"Steve" wrote:

Looking for just a basic formula to count between number or dates. Ex.
count between 1/2/2007 thru 1/31/07. I couldn't find anything in help
file.They show
or < ??
Any help would be appriciated

Steve




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
formula structure building ? check under the excel forum.... 4pinoy Excel Discussion (Misc queries) 2 November 16th 06 03:40 PM
Excel Formula Issue [email protected] Excel Discussion (Misc queries) 2 August 16th 06 11:44 PM
Match then lookup Tenacity Excel Worksheet Functions 9 December 3rd 05 05:30 AM
converting formula from lotus.123 to excel zaharah Excel Worksheet Functions 2 July 27th 05 03:04 PM
How do I view the actual numeric value of a formula in Excel 2002. Excel Function Help Excel Worksheet Functions 0 January 13th 05 10:07 PM


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