Posted to microsoft.public.excel.programming
|
|
Count of FIRST Digit
Put this formula in CO5
=SUMPRODUCT(--(LEFT(B5:CM5,1)=TEXT(COLUMN(A1),"0")))
copy across to CW5, then copy down to CO505:CW505
in CO506, add
=SUM(CO5:CO505)
and copy across to CW506
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Paul Black" wrote in message
...
Thanks for the Replies.
Bob,
Your Solution Works Great, Thanks.
Ashley,
I will have a Look at Using Pivot Tables, Thanks.
Peter,
Actually I have about 500 Rows of 100 Numbers, for Example B5:CM505.
What I would like is in Cell CO5 for Example is the Total Count of the
First Digit 1 for that Individual Row, then in Cell CP5 the Total Count
of the First Digit 2 for that Individual Row etc upto Cell CW5 and the
Total Count of the First Digit 9 for that Individual Row. Then Continue
Down All 500 Rows Putting the Counts for EACH Individual Row. It would
Also be Nice to Have a Grand Total for EACH First Digit Count at the
Bottom.
Thanks Again Everyone.
All the Best.
Paul
Count of FIRST Digit
From: Peter T
I've just seen Bob's neat Sumproduct formula. Try inserting following at
the
end of my Test macro
For i = 1 To 9
s = Chr(34) & CStr(i) & Chr(34)
Cells(i, 3).Formula = "=SUMPRODUCT(--(LEFT(A1:A100,1)=" & s & "))"
Next
Peter T
One way, if I understand the question -
Sub test()
For i = 1 To 100
Cells(i, 1) = Int(1000 * Rnd + 1)
Next
Dim nArr(1 To 9) As Long
Dim n As Long
For i = 1 To 100
n = Val(Left(Cells(i, 1), 1))
nArr(n) = nArr(n) + 1
Next
Range("b1:b9") = Application.Transpose(nArr)
End Sub
Regards,
Peter T
"Paul Black" wrote in message
...
Hi Everyone,
I have a Row of 100 Numbers that Range from 1 to 1000.
What I would like to do is to Count How Many Times the FIRST Digit
1,2,3,4,5,6,7,8 & 9 Appear in Each Row Please.
I know that I can Use Left(B10) for Example to get the FIRST Digit
But
How do you get it to do the Count Please.
Thanks in Advance.
All the Best.
Paul
*** Sent via Developersdex http://www.developersdex.com ***
|