I found an issue related to the CountIf formula: When some of the cells in the range being validated contains cells with null values, the formula's evaluation is not completed. The null value happens when, for instance, the cell contains formatting, but no value. Cells with no formatting AND no value are not considered during the formula's evaluation.
I've attached an example xlsx file, that can be used in a test. The following test can be used to confirm the behaviour
```
[TestMethod]
public void CanCountWithCountIf_IgnoringEmptyCells()
{
var path = @"C:\Users\Miguel\Desktop\ifcountif.xlsx";
var file = new FileInfo(path);
using (var ep = new ExcelPackage(file))
{
ep.Workbook.Calculate();
var s = ep.Workbook.Worksheets["Sheet1"];
var value = s.GetValue(1, 4);
Assert.AreEqual(value, 3.0);
}
}
```
I cloned the repo and found that the following code, added to the CountIf class right before the return statement in the Evaluate method (around line 44) fixes the problem, without breaking any other tests:
```
if (obj == null)
return false;
```
In relation to the unit tests, I would recommend adding the test files to the test project's folder (for instance, in a FIles folder, within the project). This way, in the tests, you can use relative paths to the dependencies, and if these are included in the repository, they can all get pulled and help get all the tests to a green state. I've used this approach frequently, and it works great when sharing code between the team and for use in the CI server, making a successful build dependent on a green set of tests.
I've attached an example xlsx file, that can be used in a test. The following test can be used to confirm the behaviour
```
[TestMethod]
public void CanCountWithCountIf_IgnoringEmptyCells()
{
var path = @"C:\Users\Miguel\Desktop\ifcountif.xlsx";
var file = new FileInfo(path);
using (var ep = new ExcelPackage(file))
{
ep.Workbook.Calculate();
var s = ep.Workbook.Worksheets["Sheet1"];
var value = s.GetValue(1, 4);
Assert.AreEqual(value, 3.0);
}
}
```
I cloned the repo and found that the following code, added to the CountIf class right before the return statement in the Evaluate method (around line 44) fixes the problem, without breaking any other tests:
```
if (obj == null)
return false;
```
In relation to the unit tests, I would recommend adding the test files to the test project's folder (for instance, in a FIles folder, within the project). This way, in the tests, you can use relative paths to the dependencies, and if these are included in the repository, they can all get pulled and help get all the tests to a green state. I've used this approach frequently, and it works great when sharing code between the team and for use in the CI server, making a successful build dependent on a green set of tests.