ADRIANA P
asked on
Count How Many Times Each Number Repeats
ASKER
Martin the firs number 15 appear 6 times not 14
why say 14 times ??
why say 14 times ??
ASKER
number 1 appear 3 times not 41
ASKER
do you think is a better way to count it ??
Working on it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
great Job !
ASKER
Great Solution!
You can use the Countif function and add all the ranges you need like this:
=COUNTIF($F$1:$F$38,CQ1)+C OUNTIF($R$ 1:$R$38,CQ 1)+COUNTIF ($AE1:$AE$ 38,CQ1)+CO UNTIF($AR1 :$AR$38,CQ 1)+COUNTIF ($BE1:$BE$ 38,CQ1)+CO UNTIF($BR1 :$BR$38,CQ 1)+COUNTIF ($CE$1:$CE $38,CQ1)
See attached (There's 7 15's)
Flyster
count-a-2_Countif.xlsx
=COUNTIF($F$1:$F$38,CQ1)+C
See attached (There's 7 15's)
Flyster
count-a-2_Countif.xlsx
You could also try...
Sub CountNumbers()
Dim dict, it
Dim rng As Range, cell As Range
Dim lr As Long, i As Long, j As Long, r As Long
lr = ActiveSheet.UsedRange.Rows.Count
Range("CM14:CN" & lr).ClearContents
Set rng = Range("F1:CE" & lr).SpecialCells(xlCellTypeVisible)
Set dict = CreateObject("Scripting.Dictionary")
For Each cell In rng
If cell <> "" And IsNumeric(cell) Then
If Not dict.exists(cell.Value) Then
dict.Item(cell.Value) = 0
Else
dict.Item(cell.Value) = dict.Item(cell.Value) + 1
End If
End If
Next cell
r = 14
For Each it In dict.keys
Range("CM" & r).Value = it
Range("CN" & r).Value = dict.Item(it)
r = r + 1
Next it
End Sub
ASKER
Flyster THNKS !! VERY GOOD !! SOLUTION
Subodh Tiwari (Neeraj) THNKS !!
INTEREST CAN YOU UPLOAD AN SAMPLE ??
Subodh Tiwari (Neeraj) THNKS !!
INTEREST CAN YOU UPLOAD AN SAMPLE ??
ASKER
Subodh Tiwari (Neeraj)
very beautiful solution !!
very beautiful solution !!
Thanks Adriana!
In that file I applied two conditional formatting rules to count 15 and 48 to just cross check the output. If you want to use that file, remove the conditional formatting rules.
In that file I applied two conditional formatting rules to count 15 and 48 to just cross check the output. If you want to use that file, remove the conditional formatting rules.
29017943.xlsm