Posted to microsoft.public.excel.programming
|
|
Help with Count Please
Hi Tom,
The Bonus is ONLY Relevant when you Match 5 Numbers.
There is a BIG £££ Difference in Matching 5 Numbers Instead of Matching
5 Numbers AND the Bonus Number.
Thanks Again.
All the Best.
Paul
Help with Count Please
From: Tom Ogilvy
You'll have to refresh my memory on how the bonus number is used. I am
not
familiar with this game.
--
Regards,
Tom Ogilvy
"Paul Black" wrote in message
...
That's Brilliant Thanks Tom,
You are Quite Right, it is for Checking my Lotto Numbers.
One Final Question Please.
I have Inserted a Column ( Column H ) for the Bonus Number.
I have Adjusted the Code so it Starts Outputting in Column Q.
How can the Code be Adjusted so it Accounts for the Bonus Number
Please.
Basically so it Outputs 0,1,2,3,4,5,5+,6.
Here is the Adjusted Code :-
Sub BB()
Dim v() As Long
Dim cell As Range
Dim cell1 As Range
Application.ScreenUpdating = False
For Each cell1 In Range(Cells(10, 10), Cells(Rows.Count,
10).End(xlUp))
Erase v
ReDim v(0 To 6)
For Each cell In Range(Cells(10, 2), Cells(Rows.Count, 2).End(xlUp))
ans = Evaluate("sum(countif(" & cell1.Resize(1, 6).Address & "," &
_
cell.Resize(1, 6).Address & "))")
v(ans) = v(ans) + 1
Next
cell1.Offset(0, 7).Resize(1, 7).Value = v
Next
Application.ScreenUpdating = True
End Sub
Thanks VERY Much for your Help on this.
All the Best.
Paul
Help with Count Please
From: Tom Ogilvy
Try this:
Sub BB()
Dim v() As Long
Dim cell As Range, cell1 As Range
For Each cell1 In Range(Cells(10, 9), Cells(Rows.Count, 9).End(xlUp))
Erase v
ReDim v(0 To 6)
For Each cell In Range(Cells(10, 2), Cells(Rows.Count, 2).End(xlUp))
ans = Evaluate("sum(countif(" & cell1.Resize(1, 6).Address & "," & _
cell.Resize(1, 6).Address & "))")
v(ans) = v(ans) + 1
Next
cell1.Offset(0, 7).Resize(1, 7).Value = v
Next
End Sub
--
Regards,
Tom Ogilvy
"Paul Black" wrote in message
...
Hi Bob,
What I Meant to Say ( my Fault for Not Explaining it Clearly ) was
that
the First Set could Contain 2,000 Sets of Numbers and the Second Set
could Contain 300 Sets of Numbers.
That is why I thought a Macro could Run through and keep a Total of
the
Number of Times 0,1,2,3,4,5,6 were Matched and then Put the Results
for
EACH Set Next to the Set in Cells P10:V10, P11:V11, P12:V12 etc.
Using Memory Hungry Formulas on this Scale Slows Down the Worksheet
to
Almost Standstill.
Thanks Again.
All the Best.
Paul
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
|