@@ -5739,6 +5739,47 @@ func TestCalcSUMIFSAndAVERAGEIFS(t *testing.T) {
57395739 }
57405740}
57415741
5742+ func TestCalcSUMIFExactMatch (t * testing.T ) {
5743+ cellData := [][]interface {}{
5744+ {"Category" , "Amount" },
5745+ {"text" , 100 },
5746+ {"***_***_text" , 200 },
5747+ {"text" , 150 },
5748+ {"***_text_***" , 300 },
5749+ {"TEXT" , 50 },
5750+ {"other" , 400 },
5751+ }
5752+ f := prepareCalcData (cellData )
5753+ formulaList := map [string ]string {
5754+ `SUMIF(A2:A7,"text",B2:B7)` : "300" ,
5755+ `COUNTIF(A2:A7,"text")` : "3" ,
5756+ `SUMIF(A2:A7,".",B2:B7)` : "0" ,
5757+ `SUMIF(A2:A7,".*",B2:B7)` : "0" ,
5758+ `SUMIF(A2:A7,".?",B2:B7)` : "0" ,
5759+ `SUMIF(A2:A7,"*text*",B2:B7)` : "800" ,
5760+ `SUMIF(A2:A7,"text*",B2:B7)` : "300" ,
5761+ `SUMIF(A2:A7,"*text",B2:B7)` : "500" ,
5762+ `SUMIF(A2:A7,"*",B2:B7)` : "1200" ,
5763+ `SUMIF(A2:A7,"othe?",B2:B7)` : "400" ,
5764+ `SUMIF(A2:A7,"~**",B2:B7)` : "500" ,
5765+ `COUNTIF(A2:A7,"*text*")` : "5" ,
5766+ `COUNTIF(A2:A7,"~*")` : "0" ,
5767+ `COUNTIF(A2:A7,"~~")` : "0" ,
5768+ `COUNTIF(A2:A7,"~?")` : "0" ,
5769+ `COUNTIF(A2:A7,"*~**")` : "2" ,
5770+ `COUNTIF(A2:A7,"~*~*~*_~*~*~*_text")` : "1" ,
5771+ `COUNTIF(A2:A7,"~*~*~*_text_~*~*~*")` : "1" ,
5772+ `COUNTIF(A2:A7,"~a")` : "0" ,
5773+ `COUNTIF(A2:A7,"<>text")` : "3" ,
5774+ }
5775+ for formula , expected := range formulaList {
5776+ assert .NoError (t , f .SetCellFormula ("Sheet1" , "C1" , formula ))
5777+ result , err := f .CalcCellValue ("Sheet1" , "C1" )
5778+ assert .NoError (t , err , formula )
5779+ assert .Equal (t , expected , result , formula )
5780+ }
5781+ }
5782+
57425783func TestCalcXIRR (t * testing.T ) {
57435784 cellData := [][]interface {}{
57445785 {- 100.00 , 42370 },
0 commit comments