diff -upr old/sc/source/core/tool/interpr1.cxx new/sc/source/core/tool/interpr1.cxx --- old/sc/source/core/tool/interpr1.cxx 2008-02-25 10:02:14.000000000 +0800 +++ new/sc/source/core/tool/interpr1.cxx 2008-03-05 11:20:30.000000000 +0800 @@ -3134,24 +3134,33 @@ double ScInterpreter::IterateParameters( } else if ( pCell->HasValueData() ) { - nCount++; - fVal = GetCellValue( aAdr, pCell ); - CurFmtToFuncFmt(); - switch( eFunc ) + if ( eFunc == ifCOUNT ) { - case ifAVERAGE: - case ifSUM: - if ( bNull && fVal != 0.0 ) - { - bNull = FALSE; - fMem = fVal; - } - else - fRes += fVal; - break; - case ifSUMSQ: fRes += fVal * fVal; break; - case ifPRODUCT: fRes *= fVal; break; - default: ; // nothing + ScFormulaCell* pFCell = (ScFormulaCell*) pCell; + if ( !pFCell->GetErrCode() ) + nCount++; + } + else + { + nCount++; + fVal = GetCellValue( aAdr, pCell ); + CurFmtToFuncFmt(); + switch( eFunc ) + { + case ifAVERAGE: + case ifSUM: + if ( bNull && fVal != 0.0 ) + { + bNull = FALSE; + fMem = fVal; + } + else + fRes += fVal; + break; + case ifSUMSQ: fRes += fVal * fVal; break; + case ifPRODUCT: fRes *= fVal; break; + default: ; // nothing + } } } else if ( bTextAsZero && pCell->HasStringData() ) @@ -3226,6 +3235,14 @@ double ScInterpreter::IterateParameters( } while (aValIter.GetNext(fVal, nErr)); break; + case ifCOUNT: + do + { + if ( !nErr ) + nCount++; + } + while (aValIter.GetNext(fVal, nErr)); + break; default: // count do {