I suspect COUNTIF is not providing the correct answers because you have a mixture of numbers and numbers stored as text.
You should be able to work around this by forcing a formatted count. As an excel formula, this would look something like:
One way to do this in VBA is something like:
Dim x, y
Dim i As Long
.ScreenUpdating = False: .DisplayAlerts = False: .EnableEvents = False
'assume column A contains the data values to be counted
x = .Columns(1).Value
'assume column B will hold the results
y = .Columns(2).Value 'don't really need values, will just initialise y
'skip the header row and loop through to do the countifs
For i = 2 To UBound(x, 1)
y(i, 1) = Application.CountIf(.Columns(1), Format(x(i, 1), "#"))
'write the results back to column B
.Columns(2).Value = y
.ScreenUpdating = True: .DisplayAlerts = True: .EnableEvents = True
This loads the entire dataset to be counted into an array and then places the countif values into a second array.
It may be more efficient than other types of loops however with nearly 350,000 rows this is still going to be very slow.
Also, loading all the data into arrays first may be more efficient but it will be memory intensive.
If you want to test it first maybe try using a smaller loop eg: