Posted 19 February 2026, 5:42 pm EST
Reproduction Steps
- Open dsexcel_countifs_bug.xlsx in DsExcel
Workbook wb = new Workbook();
wb.open(“dsexcel_countifs_bug.xlsx”, OpenFileFormat.Xlsx);
wb.calculate();
IWorksheet ws = wb.getWorksheets().get(“Customer Cube”);
System.out.println("C10 = " + ws.getRange(“C10”).getValue()); // → 2.0 (WRONG)
System.out.println("C11 = " + ws.getRange(“C11”).getValue()); // → 2.0 (WRONG)
DsExcel result: C10 through C24 all return 2.0
- Open the same file in Microsoft Excel
Press Ctrl+Shift+F9 to recalculate.
Excel result: C10 = 1, C11 through C24 = 0
Expected
DsExcel should match Excel: C10 = 1, C11-C24 = 0.
File Structure
Everything is on the Customer Cube sheet:
Rows Content Description
1 Date headers in B1:P1 Serial date numbers (44227, 44257, 44287…)
2-3 Raw customer data 2 customers, 15 months of ARR values. Customer_0 starts month 0 (all cols > 0). Customer_1 starts month 1 (col B = 0, cols C+ > 0).
5-7 Formula-based cohort dates =IFERROR(INDEX(…, MATCH(…)), “Never Active”) — finds first month with ARR > 0 for each customer. B6 = 44227, B7 = 44257.
9-24 COUNTIFS block B column = EOMONTH date chain. C-Q columns = COUNTIFS formulas.
Why C10 Should Be 1 and C11 Should Be 0
The COUNTIFS formula in C10 is:
=COUNTIFS(C$2:C$3, “>0”, $B$6:$B$7, $B10)
criteria_range1 = C2:C3 (monthly ARR for both customers)
criteria1 = “>0”
criteria_range2 = B6:B7 (formula-based cohort dates: 44227 and 44257)
criteria2 = B10 (EOMONTH date chain)
C10 (B10 = 44227):
Customer_0: C2 > 0 ✓ AND B6=44227 = B10=44227 ✓ → match
Customer_1: C3 > 0 ✓ AND B7=44257 = B10=44227 ✗ → no match
Result: 1 (Excel correct, DsExcel returns 2)
C11 (B11 = 44255 via EOMONTH):
Customer_0: B6=44227 ≠ 44255 → no match
Customer_1: B7=44257 ≠ 44255 → no match
Result: 0 (Excel correct, DsExcel returns 2)
DsExcel ignores the criteria2 date comparison entirely and returns 2 (total count of rows where C > 0) for every row.
