在excell2007中有个countifs的函数可以解决你的问题,下面是这个函数的说明.
COUNTIFS
Counts the number of cells within a range that meet multiple criteria.
Syntax
COUNTIFS(range1, criteria1,range2, criteria2…)
Range1, range2, … are 1 to 127 ranges in which to evaluate the associated criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored.
Criteria1, criteria2, … are 1 to 127 criteria in the form of a number, expression, cell reference, or text that define which cells will be counted. For example, criteria can be expressed as 32, "32", ">32", "apples", or B4.
Remarks
Each cell in a range is counted only if all of the corresponding criteria specified are true for that cell.
If criteria is an empty cell, COUNTIFS treats it as a 0 value.
You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.
Example
The example may be easier to understand if you copy it to a blank worksheet.
=COUNTIFS(B2:D2,"=Yes") Counts how many times Davolio exceeded a sales quota for Widgets, Gadgets, and Doodads (1)
=COUNTIFS(B2:B5,"=Yes",C2:C5,"=Yes") Counts how many sales people exceeded both their Widgets and Gadgets Quota (2)
=COUNTIFS(B5:D5,"=Yes",B3:D3,"=Yes") Counts how many times Leverling and Buchanan exceeded the same quota for Widgets, Gadgets, and Doodads (1)