Hi,
I am currently using a formula to count the number of similar cells through a moving range, however due to the number of rows, the calculation is too long. I was thinking abount doing the same via VBA however I am not good with looping and conditions in VBA.
The current formula I am using is the following:
This would be in cell X2, for the following cell I want to make sure that the first row in the range is incremented but the last row remains the same (therefore C3:C50000)
I have worked out the vba code for the formula however when it comes to looping it, I am stuck:
So only the cell C50000 would remain as a fixed cell, the others would get incremented by 1 until it reaches the last designated row, 50000
Any help would be greatly appreciated!
I am currently using a formula to count the number of similar cells through a moving range, however due to the number of rows, the calculation is too long. I was thinking abount doing the same via VBA however I am not good with looping and conditions in VBA.
The current formula I am using is the following:
Excel Formula:
=count.if($C2:$C$50000,C2)-1
I have worked out the vba code for the formula however when it comes to looping it, I am stuck:
VBA Code:
Sub CountCells()
Range("X3") = WorksheetFunction.CountIf(Range("C3:C50000"), Range("C3"))
End Sub
So only the cell C50000 would remain as a fixed cell, the others would get incremented by 1 until it reaches the last designated row, 50000
Any help would be greatly appreciated!