Link to home
Start Free TrialLog in
Avatar of ADRIANA P
ADRIANA PFlag for United States of America

asked on

Count How Many Times Each Number Repeats

is any way to count  the repeat numbers

thnks in advanceds!
count-a-2.xlsx
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Try this.
29017943.xlsm
Avatar of ADRIANA P

ASKER

Martin the firs number 15 appear 6 times not 14
why say 14 times ??
number 1 appear 3 times not 41
do you think  is a better way to count it ??
Working on it.
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
great Job !
Great Solution!
You can use the Countif function and add all the ranges you need like this:

=COUNTIF($F$1:$F$38,CQ1)+COUNTIF($R$1:$R$38,CQ1)+COUNTIF($AE1:$AE$38,CQ1)+COUNTIF($AR1:$AR$38,CQ1)+COUNTIF($BE1:$BE$38,CQ1)+COUNTIF($BR1:$BR$38,CQ1)+COUNTIF($CE$1:$CE$38,CQ1)

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

Open in new window

Flyster THNKS !! VERY GOOD !! SOLUTION

Subodh Tiwari (Neeraj)  THNKS !!
 INTEREST CAN YOU UPLOAD AN SAMPLE ??
Please find the attached.
In the attached, click the button to count the numbers.
CountNumbers.xlsm
Subodh Tiwari (Neeraj)
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.