--- sc/source/core/tool/interpr1.cxx 2005-11-13 23:30:11.000000000 +0530 +++ sc/source/core/tool/interpr1.cxx 2006-01-09 22:51:16.302004552 +0530 @@ -2440,6 +2442,8 @@ void ScInterpreter::ScMin( BOOL bTextAsZ double nVal = 0.0; ScAddress aAdr; ScRange aRange; + bool bEmptyCells = FALSE; + for (short i = 0; i < nParamCount; i++) { switch (GetStackType()) @@ -2466,6 +2470,8 @@ void ScInterpreter::ScMin( BOOL bTextAsZ if ( nMin > 0.0 ) nMin = 0.0; } + else if ( pCell && pCell->GetStringData().Len() == 0 ) + bEmptyCells = TRUE; } break; case svDoubleRef : @@ -2485,6 +2491,8 @@ void ScInterpreter::ScMin( BOOL bTextAsZ } SetError(nErr); } + else + bEmptyCells = TRUE; } break; case svMatrix : @@ -2520,6 +2528,8 @@ void ScInterpreter::ScMin( BOOL bTextAsZ if ( nMin > 0.0 ) nMin = 0.0; } + else if ( pMat->IsEmpty(i,j) ) + bEmptyCells = TRUE; } } } @@ -2544,7 +2554,12 @@ void ScInterpreter::ScMin( BOOL bTextAsZ } } if (nMin == SC_DOUBLE_MAXVALUE) - SetIllegalArgument(); + { + if (bEmptyCells) + PushDouble(0.0); + else + SetIllegalArgument(); + } else PushDouble(nMin); } @@ -2560,6 +2575,8 @@ void ScInterpreter::ScMax( BOOL bTextAsZ double nVal = 0.0; ScAddress aAdr; ScRange aRange; + bool bEmptyCells = FALSE; + for (short i = 0; i < nParamCount; i++) { switch (GetStackType()) @@ -2586,6 +2603,8 @@ void ScInterpreter::ScMax( BOOL bTextAsZ if ( nMax < 0.0 ) nMax = 0.0; } + else if ( pCell && pCell->GetStringData().Len() == 0 ) + bEmptyCells = TRUE; } break; case svDoubleRef : @@ -2605,6 +2624,8 @@ void ScInterpreter::ScMax( BOOL bTextAsZ } SetError(nErr); } + else + bEmptyCells = TRUE; } break; case svMatrix : @@ -2640,6 +2661,8 @@ void ScInterpreter::ScMax( BOOL bTextAsZ if ( nMax < 0.0 ) nMax = 0.0; } + else if ( pMat->IsEmpty(i,j) ) + bEmptyCells = TRUE; } } } @@ -2664,7 +2687,12 @@ void ScInterpreter::ScMax( BOOL bTextAsZ } } if (nMax == -SC_DOUBLE_MAXVALUE) - SetIllegalArgument(); + { + if (bEmptyCells) + PushDouble(0.0); + else + SetIllegalArgument(); + } else PushDouble(nMax); }