Count cells from Company to Company.

Deleted
Not applicable

Company  402 has 5 lines before Company 421. Want to enter the line count either in formula or Macro. Any help would be appreciated.

  Count
1Company Number:   4025
 ABC MANUFACTURING CO., INC.5
 1 JONES RD SE5
 ATLANTA GA 303155
 Yes5
1Company Number:   4216
 JAMES, LLC6
 1 SWITZ6
 ST LOUIS MO 631476
 555/555-55556
                      No active products6
1Company Number:   4648
 THE Company8
 1821 LARKIN8
 MIDLAND MI 8
 555/555-55558
 Yes8
 No active8
  8
1Company Number:   4025
 DEF MANUFACTURING CO., INC.5
 1 JONES RD SE5
 ATLANTA GA 303155
 Yes5
1Company Number:   402 
4 Replies

Hi Matt,

 

Starting from C3

=IF(ISBLANK(A3),C2+1,1)

and attached

Can I get the count cells to all be the total number of cells counted? instead of 1-5 it puts 5 in all of them, or 6 depending on how many rows are counted?

Matt,

 

formula for helper column D:

=IF(A2,SUM(D1,1),D1)

Formula for column B:

=COUNTIFS($D$2:$D$41,D2) 

 

or

=IF(ISBLANK(A2),C1,IFNA(MATCH(FALSE,ISBLANK(OFFSET(A2,1,0,2000)),0),COUNTA(B2:B2000)))

but it depends on how the list of companies ended. Here I assume there are only blank cells after it.