text: public static int CountMatchingCellsInRef(RefEval refEval, IMatchPredicate criteriaPredicate){int result = 0;for (int sIx = refEval.FirstSheetIndex; sIx <= refEval.LastSheetIndex; sIx++){ValueEval ve = refEval.GetInnerValueEval(sIx);if (criteriaPredicate.Matches(ve)){result++;}}return result;}