Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Formula Problem?

Status
Not open for further replies.

gjmac2

IS-IT--Management
Mar 31, 2006
45
US
Having problem with an Excel formula.

I have a worksheet I have named 12-25.

There are two columns that I need to compare from, which are b2:b54, wich is a date column, and d2:d54, which is a text column.

On a seperate worksheet, I am trying to count how many times a given value in d2:d54 falls within a date range in b2:b54. I have tried an =IF(AND function, but cannot get Access to tabulate what I am looking for. Here is an example of the formula I am trying to use:

=COUNT(IF(AND('12-25'!b2:b54>"12/31/2007"+0,'12-25'!b2:b54<"02/01/2008"+0,'12-25'!d2:d54="ABC"),'12-25'!A2:A54))

Any help would be greatly appreciated.

Thanks
 



Hi,
[tt]
=SUMPRODUCT(('12-25'!B2:B54>"12/1/2007"+0)*('12-25'!B2:B54<"2/1/2008"+0)*('12-25'!D2:D54="ABC")*('12-25'!A2:A54))
[/tt]

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I appreciate the reply, and I tried your formula. However, instead of counting the instances, it adds the the values from column A. Is there anyway I can get a count of the instances from column A?
 



BTW, I perfer to use Named Ranges. 1) the formula is much more understandable 2) there is less danger of propogating an incorrect range reference (which should be ABSOLUTE,ABSOLUTE)

I also prefer referencing values rather than hard-coding values, like the From & Thru dates and the string.

Assuming that From, Thru and string are in A1:C1 and that the 4 columns ranges are named MySumValues, MyDates, MyStrings...
[tt]
=SUMPRODUCT((MyDates>A1)*(MyDates<B1)*(MyStrings=C1)*(MySumValues))
[/tt]

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



If you are simply COUNTING...
[tt]
=SUMPRODUCT(--('12-25'!B2:B54>"12/1/2007"+0)*('12-25'!B2:B54<"2/1/2008"+0)*('12-25'!D2:D54="ABC"))
[/tt]

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



If you are merely counting, why would you include ANYTHING from column A?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
That worked. Do not know what I was thinking about counting colum A. Thank you for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top