mirror of https://github.com/apache/poi.git
SUMIFS should sum and treat booleans and strings as zero
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891905 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d8d60e4e72
commit
f4cf7dc99e
|
@ -382,6 +382,15 @@ final class TestSumifs {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMicrosoftExample1WithBooleanAndString() throws IOException {
|
||||
try (HSSFWorkbook wb = initWorkbook1()) {
|
||||
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
|
||||
HSSFCell cell = wb.getSheetAt(0).getRow(0).createCell(100);
|
||||
assertDouble(fe, cell, "SUMIFS(A2:A11, B2:B11, \"<>Bananas\", C2:C11, \"Tom\")", 30);
|
||||
}
|
||||
}
|
||||
|
||||
//see https://support.microsoft.com/en-us/office/sumifs-function-c9e748f5-7ea7-455d-9406-611cebce642b
|
||||
private HSSFWorkbook initWorkbook1() {
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
|
@ -404,4 +413,12 @@ final class TestSumifs {
|
|||
addRow(sheet, 9, FormulaError.NA, "Pears", "Tom");
|
||||
return wb;
|
||||
}
|
||||
|
||||
private HSSFWorkbook initWorkbook1WithBooleanAnString() {
|
||||
HSSFWorkbook wb = initWorkbook1();
|
||||
HSSFSheet sheet = wb.getSheetAt(0);
|
||||
addRow(sheet, 9, true, "Pears", "Tom");
|
||||
addRow(sheet, 10, "abc", "Kumquats", "Tom");
|
||||
return wb;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue