View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Count occurances in a range.

On Friday, April 20, 2012 12:55:28 PM UTC-5, Brian wrote:
I am using Excel 2007 and windows 7
I have a range of cells C5:F32 which is full of numbers.
I am running code which steps me through every cell starting with the first column C5 to C32, moving to the next column and doing the same and ending with the last Number in column F.
When it stops at each cell I need to determine how many times the same number has appeared in that range in rows prior to the row of the cell I am currently in.
That determines if the number of the cell I am currently in is the 1st 2nd, 3rd or 4th time that number has appeared. The same number is never repeated in the same row so it only has to count the number of times it appears in previous rows and then obviously add 1 to determine the 1st 2nd etc. Numbers appearing in the first row will always be the first time they appear but the first time a number appears could also be in any other row.The result of the number of times it has occured is posted in cell U1
Can anyone help with the code I need.


Hard to visualize so send file to dguillett1 @gmail.com with this msg and examples