Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a row of numbers that can be repeated multiple times.
I would like to be able to count how many times the first number is listed and continue all the way through until no more numbers a left to check. eg 6 32 32 7 45 23 23 7 54 how do I write a program to go through each number and check how many times that number is listed in the row. The numbers always very so I cannot use a set value. Thanks Noemi |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this is a rudimentary solution, i'm sure someone can streamline it, but it
will put how many times a number is listed in the range, next to it in column b Option Explicit Dim mg As Range Dim LastRow As Long Dim TestFor As Long Dim cell As Range Dim CurRow As Long Sub test() LastRow = Range("a1").End(xlDown).End(xlDown).Row CurRow = LastRow Set mg = Range("a1:a" & LastRow) For Each cell In mg TestFor = Range("a" & CurRow).Value Range("b" & CurRow).Formula = "=CountIf(a1:a" & LastRow & "," & "" & TestFor & "" & ")" CurRow = CurRow - 1 Next cell End Sub -- Gary "Noemi" wrote in message ... I have a row of numbers that can be repeated multiple times. I would like to be able to count how many times the first number is listed and continue all the way through until no more numbers a left to check. eg 6 32 32 7 45 23 23 7 54 how do I write a program to go through each number and check how many times that number is listed in the row. The numbers always very so I cannot use a set value. Thanks Noemi |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Why not just use a formula
=COUNTIF(A:A,A1) and copy down -- HTH Bob Phillips "Noemi" wrote in message ... I have a row of numbers that can be repeated multiple times. I would like to be able to count how many times the first number is listed and continue all the way through until no more numbers a left to check. eg 6 32 32 7 45 23 23 7 54 how do I write a program to go through each number and check how many times that number is listed in the row. The numbers always very so I cannot use a set value. Thanks Noemi |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivot Tables - Count Numbers vs. Count | Excel Discussion (Misc queries) | |||
How do i count numbers and letters to find a total count of all | Excel Worksheet Functions | |||
Number count - postcodes and need to count the numbers of tim... | Excel Discussion (Misc queries) | |||
Count comma separated numbers, numbers in a range with dash, not t | Excel Discussion (Misc queries) | |||
count a group of numbers but do not count duplicates | Excel Worksheet Functions |