Index: sc/source/core/tool/interpr1.cxx
===================================================================
--- sc/source/core/tool/interpr1.cxx.orig	2006-01-18 21:13:13.000000000 +0100
+++ sc/source/core/tool/interpr1.cxx	2006-01-18 21:14:08.000000000 +0100
@@ -2884,7 +2884,12 @@ double ScInterpreter::IterateParameters(
 	switch( eFunc )
 	{
 		case ifSUM:		fRes = ::rtl::math::approxAdd( fRes, fMem ); break;
-		case ifAVERAGE:	fRes = ::rtl::math::approxAdd( fRes, fMem ) / nCount; break;
+		case ifAVERAGE:	
+					if( nCount == 0 ) 
+						SetError( errDivisionByZero );
+					else
+						fRes = ::rtl::math::approxAdd( fRes, fMem ) / nCount; 
+					break;
 		case ifCOUNT2:
 		case ifCOUNT:	fRes  = nCount; break;
 		case ifPRODUCT:	if ( !nCount ) fRes = 0.0; break;
@@ -3056,7 +3061,11 @@ void ScInterpreter::ScVar( BOOL bTextAsZ
 	double nVal;
 	double nValCount;
 	GetStVarParams( nVal, nValCount, bTextAsZero );
-	PushDouble(nVal / (nValCount - 1.0));
+
+	if( nValCount <= 1.0 )
+		SetError( errDivisionByZero );
+	else
+		PushDouble(nVal / (nValCount - 1.0));
 }
 
 
@@ -3065,7 +3074,11 @@ void ScInterpreter::ScVarP( BOOL bTextAs
 	double nVal;
 	double nValCount;
 	GetStVarParams( nVal, nValCount, bTextAsZero );
-	PushDouble(nVal / nValCount);
+
+	if( nValCount == 0.0 )
+		SetError( errDivisionByZero );
+	else
+		PushDouble(nVal / nValCount);
 }
 
 
@@ -3074,7 +3087,10 @@ void ScInterpreter::ScStDev( BOOL bTextA
 	double nVal;
 	double nValCount;
 	GetStVarParams( nVal, nValCount, bTextAsZero );
-	PushDouble(sqrt(nVal / (nValCount - 1.0)));
+	if( nValCount <= 1.0 )
+		SetError( errDivisionByZero );
+	else
+		PushDouble(sqrt(nVal / (nValCount - 1.0)));
 }
 
 
@@ -3083,7 +3099,10 @@ void ScInterpreter::ScStDevP( BOOL bText
 	double nVal;
 	double nValCount;
 	GetStVarParams( nVal, nValCount, bTextAsZero );
-	PushDouble(sqrt(nVal / nValCount));
+	if( nValCount == 0.0 )
+		SetError( errDivisionByZero );
+	else
+		PushDouble(sqrt(nVal / nValCount));
 }
 
 
Index: sc/source/core/tool/interpr2.cxx
===================================================================
--- sc/source/core/tool/interpr2.cxx.orig	2006-01-18 21:13:13.000000000 +0100
+++ sc/source/core/tool/interpr2.cxx	2006-01-18 21:14:08.000000000 +0100
@@ -1434,7 +1434,9 @@ void ScInterpreter::ScMod()
 	{
 		double nVal2 = GetDouble();
 		double nVal1 = GetDouble();
-        PushDouble( ::rtl::math::approxSub( nVal1,
+		if( nVal2 == 0.0 )
+			SetError( errDivisionByZero );
+		PushDouble( ::rtl::math::approxSub( nVal1,
                     ::rtl::math::approxFloor(nVal1 / nVal2) * nVal2));
 	}
 }
Index: sc/source/core/tool/interpr3.cxx
===================================================================
--- sc/source/core/tool/interpr3.cxx.orig	2006-01-18 21:13:13.000000000 +0100
+++ sc/source/core/tool/interpr3.cxx	2006-01-18 21:14:08.000000000 +0100
@@ -1074,7 +1074,9 @@ void ScInterpreter::ScNormDist()
 		double sigma = GetDouble();					// Stdabw
 		double mue = GetDouble();					// Mittelwert
 		double x = GetDouble();						// x
-		if (sigma <= 0.0)
+		if (sigma == 0.0)
+			SetError( errDivisionByZero );
+		else if (sigma < 0.0)
 			SetIllegalArgument();
 		else if (kum == 0.0)						// Dichte
 			PushDouble(phi((x-mue)/sigma)/sigma);
@@ -1090,7 +1092,9 @@ void ScInterpreter::ScLogNormDist()
 		double sigma = GetDouble();					// Stdabw
 		double mue = GetDouble();					// Mittelwert
 		double x = GetDouble();						// x
-		if (sigma <= 0.0 || x <= 0.0)
+		if (sigma == 0.0 )
+			SetError( errDivisionByZero );
+		else if (sigma < 0.0 || x <= 0.0)
 			SetIllegalArgument();
 		else
 			PushDouble(0.5 + gauss((log(x)-mue)/sigma));
@@ -1733,7 +1737,9 @@ void ScInterpreter::ScConfidence()
 		double n     = ::rtl::math::approxFloor(GetDouble());
 		double sigma = GetDouble();
 		double alpha = GetDouble();
-		if (sigma <= 0.0 || alpha <= 0.0 || alpha >= 1.0 || n < 1.0)
+		if (sigma == 0.0 )
+			SetError( errDivisionByZero );
+		else if (sigma < 0.0 || alpha <= 0.0 || alpha >= 1.0 || n < 1.0)
 			SetIllegalArgument();
 		else
 			PushDouble( gaussinv(1.0-alpha/2.0) * sigma/sqrt(n) );
@@ -1839,7 +1845,7 @@ void ScInterpreter::ScZTest()
 		default : SetError(errIllegalParameter); break;
 	}
 	if (rValCount <= 1.0)
-		SetNoValue();
+		SetError( errDivisionByZero );
 	else
 	{
 		mue = fSum/rValCount;
@@ -2275,6 +2281,9 @@ void ScInterpreter::ScKurt()
 		}
 	}
 
+	if (fCount == 0)
+		SetError( errDivisionByZero );
+
 	if (nGlobalError)
 	{
 		PushInt(0);
@@ -2551,7 +2560,9 @@ void ScInterpreter::ScStandard()
 		double sigma = GetDouble();
 		double mue   = GetDouble();
 		double x     = GetDouble();
-		if (sigma <= 0.0)
+		if (sigma == 0.0)
+			SetError( errDivisionByZero );
+		else if (sigma < 0.0)
 			SetIllegalArgument();
 		else
 			PushDouble((x-mue)/sigma);
