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-18 11:48:26.000000000 +0800 @@ -6281,6 +6281,7 @@ void ScInterpreter::ScIndex() SCCOL nCol2 = 0; SCROW nRow2 = 0; SCTAB nTab2 = 0; + BOOL bRowArray = FALSE; if (GetStackType() == svRefList) { ScTokenRef xRef = PopToken(); @@ -6292,12 +6293,19 @@ void ScInterpreter::ScIndex() ScRange aRange( ScAddress::UNINITIALIZED); DoubleRefToRange( (*(xRef->GetRefList()))[nArea-1], aRange); aRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2); + if ( nParamCount == 2 && nRow1 == nRow2 ) + bRowArray = TRUE; } else + { PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2); + if ( nParamCount == 2 && nRow1 == nRow2 ) + bRowArray = TRUE; + } if ( nTab1 != nTab2 || (nCol > 0 && nCol1+nCol-1 > nCol2) || - (nRow > 0 && nRow1+nRow-1 > nRow2) ) + (nRow > 0 && nRow1+nRow-1 > nRow2 && !bRowArray ) || + ( nRow > nCol2 - nCol1 + 1 && bRowArray )) PushIllegalArgument(); else if (nCol == 0 && nRow == 0) { @@ -6318,6 +6326,12 @@ void ScInterpreter::ScIndex() { if ( nCol1 == nCol2 ) PushSingleRef( nCol1, nRow1+nRow-1, nTab1 ); + else if ( bRowArray ) + { + nCol =(SCCOL) nRow; + nRow = 1; + PushSingleRef( nCol1+nCol-1, nRow1+nRow-1, nTab1); + } else PushDoubleRef( nCol1, nRow1+nRow-1, nTab1, nCol2, nRow1+nRow-1, nTab1);