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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sumproduct just isn't enough

Status
Not open for further replies.

johnturgoose

Technical User
Jan 21, 2004
38
GB
I am trying to use the sumproduct function to count based on multiple criteria.

centre_code, dateR, trials_unit.

Basically I want to count the number of records where trials unit = X and DateR falls between 2 dates. Sumproduct... Easy. The problem is that there are multiple records with the same centre_code and what I really want to do is to count the number of different centre_codes that meet the criteria rather than the number of records.

Many thanks for your help

John
 
Two options...

Try using the pivot table wizard (it's intimidating at first, but very powerful)...and it leaves your original data unmodified

-or-

Look in the help on the DCOUNT() or DCOUNTA() functions

 
You could do this with a array formula (ie input with Ctrl-Shift-Enter instead of just Enter). The following formula is one example:

=SUM(IF((A1:A100="My Center")*(B1:B100>=DATE(2000,1,1))*(B1:B100<=DATE(2000,12,31)),C1:C100))

where:
'centre_code' is in A1:A100, and the 'centre_code' being tested is 'My Center'
'dateR' is in B1:B100, and the 'dateR'being tested is from 1/1/2000 to 31/12/2000 (or 12/31/2000 for the US)
'trials_unit' is in C1:C100

Instead of hard-coding the source ranges, you could use named ranges and, instead of hard-coding the criteria, you could use cell references.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top