final Range rng = (Range) result;
final Cell[][][] rngcella = rng.getCellsArray();
final int colsz = rng.getColumnSize();
final int rowsz = rng.getRowSize();
if (colsz == 1 && rowsz == 1) { //single cell range
final Cell rngcell = rngcella[0][0][0];
if (rngcell == null) {
result = Objects.ZERO_DOUBLE;
} else {
result = rngcell.getResult();
}
} else if (colsz > 1 && rowsz > 1) {
result = SSError.VALUE;
} else if (colsz == 1) {
final int row = getRow();
final int rngtop = rng.getTop();
final int rngbottom = rng.getBottom();
if (row >= rngtop && row <= rngbottom) {
final int rowidx = row - rngtop;
final Cell rngcell = rngcella[0][rowidx][0];
if (rngcell == null) {
result = Objects.ZERO_DOUBLE;
} else {
result = rngcell.getResult();
}
} else {
result = SSError.VALUE;
}
} else { //rowsz == 1
final int col = getColumn();
final int rngleft = rng.getLeft();
final int rngright = rng.getRight();
if (col >= rngleft && col <= rngright) {
final int colidx = col - rngleft;
final Cell rngcell = rngcella[0][0][colidx];
if (rngcell == null) {
result = Objects.ZERO_DOUBLE;
} else {
result = rngcell.getResult();
}
} else {
result = SSError.VALUE;
}
}