请参考
- public override bool AcceptsReference(int i)
- {
- return i == 0;
- }
- public override object Evaluate(object[] args)
- {
- CalcReference range = args[0] as CalcReference;
- double criteria = CalcConvert.ToDouble(args[1]);
- double count = 0.0;
- if (range == null)
- return CalcError.Value;
- for (int i = range.Row; i < range.Row + range.RowCount; i++)
- {
- for (int j = range.Column; j < range.Column + range.ColumnCount; j++)
- {
- double cellValue = CalcConvert.ToDouble(range.GetValue(i, j));
- if (cellValue < criteria)
- count++;
- }
- }
- return count;
- }
- }
复制代码 |