Seandobson2402
New Member
- Joined
- Feb 9, 2018
- Messages
- 23
Hi All,
I have the below code to count through columns BL, BM and BN on my Completed Sheet. The information entered into these columns can be - 1.1 or 1.2 or 2.1 or 2.2 or 3 or 4.
The information is then pasted into OverallStats Sheet columns C22 to E28.
Row 22 being 1.1, Row 23 being 1.2 and so on. However, my count is adding the 1.1 and 1.2 / The 2.1 and 2.2 into the same values (ie If I have 2 x 1.1 and 1 x 1.2 - It will display that I have 3 x 1.1 and 0 x 1.2)
Any idea how I could split the result out to display exact matches?
I have the below code to count through columns BL, BM and BN on my Completed Sheet. The information entered into these columns can be - 1.1 or 1.2 or 2.1 or 2.2 or 3 or 4.
The information is then pasted into OverallStats Sheet columns C22 to E28.
Row 22 being 1.1, Row 23 being 1.2 and so on. However, my count is adding the 1.1 and 1.2 / The 2.1 and 2.2 into the same values (ie If I have 2 x 1.1 and 1 x 1.2 - It will display that I have 3 x 1.1 and 0 x 1.2)
Any idea how I could split the result out to display exact matches?
Code:
Sub FillCatTable()
Dim CatValue As Double
With ThisWorkbook
With .Worksheets("Completed")
For CatValue = 1.1 To 4
'get my cat stats
ThisWorkbook.Worksheets("OverallStats").Cells(22 + CatValue, "C").Value = WorksheetFunction.CountIfs(.Range("BL:BL"), CatValue)
'get his cat stats
ThisWorkbook.Worksheets("OverallStats").Cells(22 + CatValue, "D").Value = WorksheetFunction.CountIfs(.Range("BM:BM"), CatValue)
'get her cat stats
ThisWorkbook.Worksheets("OverallStats").Cells(22 + CatValue, "E").Value = WorksheetFunction.CountIfs(.Range("BN:BN"), CatValue)
Next CatValue
'get my cat stats
ThisWorkbook.Worksheets("OverallStats").Cells(28, "C").Value = WorksheetFunction.CountIfs(.Range("BL:BL"), "N/A")
'get his cat stats
ThisWorkbook.Worksheets("OverallStats").Cells(28, "D").Value = WorksheetFunction.CountIfs(.Range("BM:BM"), "N/A")
'get her cat stats
ThisWorkbook.Worksheets("OverallStats").Cells(28, "E").Value = WorksheetFunction.CountIfs(.Range("BN:BN"), "N/A")
End With
End With
End Sub