Count occurrances in a range

brianfosterblack

Active Member
Joined
Nov 1, 2011
Messages
251
I have a range B2 to F35 but this range size can change.
In the headings I have shooting range numbers and down column A, I have times in sequential order from the earlies to latest time. In the range I enter squad numbers so each squad gets to shoot. The number of ranges can vary as can the number of squads
What I want to do is start in column B and step though each cell and then move to column C and step though each cell and so on. Some cells could be empty.
As I step through it must pick up the squad number in the activecell and put that in the scoresheet and it must count how many times that squad has shot already for the day. I have all the rest of the code to do this but do not know what to use to determine what round number this is for the squad. When I put the round number on the scoresheet I then print the scoresheet and move to the next cell and run the sequence again for the next scoresheet. In this way I print all the scoresheets for each squad shooting each shooting range in time order.
Can you help with the code which will determine which round number this is in the range so I can enter it on the scoresheet. This will be determined by counting the number of times the value in the activecell has occured in rows in the range previous to the row I am currently in and then add 1 to get the round number. I am using Excel 2007
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top