View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jason[_30_] Jason[_30_] is offline
external usenet poster
 
Posts: 8
Default Counting groups of similar items

Hi Folks. I have a row of labels. These labels are in groups (one
label for each hour that a particular product spec is being run, in
case you were interested). I would like to count the number of cells
that each group takes up e.g.

Row 1: a a a a b b b b b c c c a a a a c c c c c c c...
Row 2: 1 2 3 4 1 2 3 4 5 1 2 3 1 2 3 4 1 2 3 4 5 6 7...

Row 2 is calculated and shows that the first run of ‘a' goes for 4
hours followed by a run of ‘b' for 5 hours and then another 4 hour run
of ‘a' etc etc I thought I was getting close to formula solution using
offset, match and countif, but ran into problems when the same label
was used later down the line (like ‘a' in the example).

A more elegant solution would be if I could have a macro give me the
total run length for the spec that was in the current active cell .
Say I was on a ‘b' the macro would pop up a 5 somewhere, telling me
that that run is planned for 5 hours. (in reality I'll be looking up
the max run length for that spec and displaying it minus the 5 hours
that are planned for that run).

Anyway, I hope that's enough to explain what I am trying to achieve.

Any input is appreciated, thanks,
Jason.