How to sum subtotal with blank line

  • Thread starter Thread starter hon123456
  • Start date Start date
H

hon123456

Dear all,

I have excel data as follows:


NO Pieces
--------- ----------
A001 10 pc
[blank line]
A001 20 pc
[blank line]
A001 30 pc
[blank line]
A002 15 pc
[blank line]
A002 15 pc


Now I want to write a VBA to sum a subtotal for the
column
of A001 and A002, the outcomes
should as follows:


NO Pieces Subtotal
--------- ---------- ------------
A001 10 pc
[blank line]
A001 20 pc
[blank line]
A001 30 pc 60pc
[blank line]
A002 15 pc
[blank line]
A002 15 pc 30pc


How can I do that in Excel with VBA or other method ?


Thanks.
 
If the subtotal does not have to be offset from the last occurence as
displayed, you could use a simple sumif for each "NO".
=Sumif(A3:A24,"A001",B3:B25) This assumes Pieces are in B3 to B25 and
"NO" starts at A3 to A25. Data in column B must be values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top