ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sumproduct from previously blank row (https://www.excelbanter.com/excel-programming/411968-sumproduct-previously-blank-row.html)

Jim

Sumproduct from previously blank row
 
I would like to create a macro that will perform a sumproduct for all row
above where I start, up to the first cell after a blank row.

IE:

1: 2 | 4
2: 4 | 6
3:
4: 6 | 8
5: 10 | 12
6: Sumproduct=(A4:A5,B4:B5)

Where, A4:A5,B4:B5 could be any range UP to the next blank row.

Thanks

Bob Phillips

Sumproduct from previously blank row
 
=SUM(A5:INDEX(A1:A5,MAX(IF(A1:A5="",ROW(A1:A5)))+1 )*B5:INDEX(B1:B5,MAX(IF(A1:A5="",ROW(A1:A5)))+1))

which is an array formula, it should be committed with Ctrl-Shift-Enter, not
just Enter.
Excel will automatically enclose the formula in braces (curly brackets), do
not try to do this manually.
When editing the formula, it must again be array-entered.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jim" wrote in message
...
I would like to create a macro that will perform a sumproduct for all row
above where I start, up to the first cell after a blank row.

IE:

1: 2 | 4
2: 4 | 6
3:
4: 6 | 8
5: 10 | 12
6: Sumproduct=(A4:A5,B4:B5)

Where, A4:A5,B4:B5 could be any range UP to the next blank row.

Thanks




Jim

Sumproduct from previously blank row
 
Hi Bob. Thanks for the reply. I want to be able to do this multiple times
across several row chunks. I guess I could be a bit more clear in my IE:

1: 2 | 4
2: 4 | 6
3: Sumproduct (A1:A2,B1:B2)
4:
5: 6 | 8
6: 4 | 7
7: 10 | 12
8: Sumproduct=(A5:A7,B5:B7)
Where row 8 sums rows above it to the point where there is a blank row and
where the arrays are different in number of rows.

Thanks!
Jim

"Bob Phillips" wrote:

=SUM(A5:INDEX(A1:A5,MAX(IF(A1:A5="",ROW(A1:A5)))+1 )*B5:INDEX(B1:B5,MAX(IF(A1:A5="",ROW(A1:A5)))+1))

which is an array formula, it should be committed with Ctrl-Shift-Enter, not
just Enter.
Excel will automatically enclose the formula in braces (curly brackets), do
not try to do this manually.
When editing the formula, it must again be array-entered.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jim" wrote in message
...
I would like to create a macro that will perform a sumproduct for all row
above where I start, up to the first cell after a blank row.

IE:

1: 2 | 4
2: 4 | 6
3:
4: 6 | 8
5: 10 | 12
6: Sumproduct=(A4:A5,B4:B5)

Where, A4:A5,B4:B5 could be any range UP to the next blank row.

Thanks






All times are GMT +1. The time now is 12:00 AM.

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