Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default counting occurences of cell matches

Hi - I'm a golf fanatic trying to do some analysis of my golf scores,
counting the number of pars, birdies, bogeys I get during any given round of
golf. Assume two rows, 18 columns; I want to count the number of of
occurences that the top row cell (for example B1) equals the bottom row cell
(B2); how often the top row cell (C1 for example) = bottom row cell (C2 for
example) +1; how often the top row cell = bottom row cell -1; etc. The top
row is par for the hole, remains constant; The second row is my score on that
hole. The formulas provide me with the number of pars, birdies bogeys etc I
get on any given round of golf. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default counting occurences of cell matches


Assuming that Row 1 will be the hole numbers and Column A will be for
players names:

Sub golf()
Dim P As Range
For Each p In Range("B2:S2")
If P.Value = P.Offset(1, 0) Then
Par = Par + 1
ElseIf p.Value - 1 = P.Offset(1, 0) Then
Birdie = Birdie + 1
ElseIf p.Value - 2 = P.Offset(1, 0) Then
Eagle = Eagle + 1
ElseIf p.Value + 1 = P.Offset(0, 1) Then
Bogey = Bogey + 1
Elseif p.Value + 2 = p.Offset(0, 1) Then
DBogey = DBogey + 1
Else
Throw_out = Throw_out + 1
End If
Next
MsgBox Par & " Pars." & vbLf & _
Birdie & " Birdies." & vbLf _
Eagle & " Eagles." & vbLf _
Bogey & " Bogeys." & vbLf _
DBogey & " Double Bogeys." & vbLf _
Throw_out & " Throw out holes."
End Sub

This will give you the whole picture.





"Lee H" wrote:

Hi - I'm a golf fanatic trying to do some analysis of my golf scores,
counting the number of pars, birdies, bogeys I get during any given round of
golf. Assume two rows, 18 columns; I want to count the number of of
occurences that the top row cell (for example B1) equals the bottom row cell
(B2); how often the top row cell (C1 for example) = bottom row cell (C2 for
example) +1; how often the top row cell = bottom row cell -1; etc. The top
row is par for the hole, remains constant; The second row is my score on that
hole. The formulas provide me with the number of pars, birdies bogeys etc I
get on any given round of golf. Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting occurences of a name [email protected] Excel Worksheet Functions 3 October 8th 07 12:52 AM
Counting occurences of characters in a cell John Excel Worksheet Functions 3 April 27th 07 03:40 PM
Counting the occurences riomarde Excel Worksheet Functions 1 March 27th 06 09:00 PM
Counting Occurences Pete Excel Discussion (Misc queries) 7 May 2nd 05 08:28 PM
Help on counting occurences Krishna[_3_] Excel Programming 3 July 28th 04 04:45 AM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"