[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Re: Calculate number of records in a Group

Greg Glynn

12/19/2006 2:43:00 AM

Nigel,

Depending in your data, you may be able to use the
CurrentRegion.Rows.Count property

j = ActiveCell.CurrentRegion.Rows.Count

If you know where the first row of any group starts, you can activate
that cell then use the ActiveCell.CurrentRegion.Rows.Count property.

Hope this helps.

Greg


Nigel wrote:
> I have data in a spreadsheet that is grouped by Customer and between each
> grouping there are 2 blank lines
>
> What I have to do is calculate the sum of the a column (for example Y) so
> for the first customer it would be sum(y7:y23) and for the next customer it
> would be sum(y26:y30) but when I rerun the data it might be (Y7:y15) and
> (y18:y22) and so forth depending on the conditions I apply
>
> Is there any way I can calculate the number of records each grouping
> contains, In column B at the top of the group will be the customer name and
> in column B at the end of the group the customer name will appear again if
> that helps to calculate the number of rows inclusive of the top and bottom
> rows