numerator = WorksheetFunction.Sum(Application.CountIfs(.Range(.Cells(2, colorColumn), .Cells(LastRow, colorColumn)), red, _
.Range(.Cells(2, brandColumn), .Cells(LastRow, brandColumn)), BrandArray(i), _
.Range(.Cells(2, purposeColumn), .Cells(LastRow, purposeColumn)), 1, _
.Range(.Cells(2, materialColumn), .Cells(LastRow, materialColumn)), Array(1, 2, 3, 7, 8, 9, 10))) + _
WorksheetFunction.Sum(Application.CountIfs(.Range(.Cells(2, colorColumn), .Cells(LastRow, colorColumn)), blue, _
.Range(.Cells(2, brandColumn), .Cells(LastRow, brandColumn)), BrandArray(i), _
.Range(.Cells(2, purposeColumn), .Cells(LastRow, purposeColumn)), 1, _
.Range(.Cells(2, materialColumn), .Cells(LastRow, materialColumn)), Array(1, 2, 3, 7, 8, 9, 10)))
Here, the numerator would contain the count of cells with colors red or blue in the colorColumn, for the i index in the BrandArray in the brandColumn, with a purpose of 1 within the purposeColumn, with the material codes of 1,2,3,7,8,9, or 10 in the materialColumn. But I must be doing something wrong because the code only checks for 1 in the materialColumn, not the full list of numbers (the rest of the code works as normal).
Bookmarks