ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calculate number of records in a Group (https://www.excelbanter.com/excel-programming/379668-re-calculate-number-records-group.html)

Greg Glynn

Calculate number of records in a Group
 
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




All times are GMT +1. The time now is 03:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com