Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Jim is offline
external usenet poster
 
Posts: 615
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Jim is offline
external usenet poster
 
Posts: 615
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sumproduct - Return value as Blank Lilyput Excel Discussion (Misc queries) 3 May 28th 10 02:52 AM
Sumproduct thru blank cells Harsh Bahal Excel Worksheet Functions 4 March 5th 09 06:56 AM
=SUMPRODUCT Col E = B, Col F = blank 77Debbie77 Excel Worksheet Functions 7 August 28th 08 09:14 PM
SUMPRODUCT - Ignore blank rows sahafi Excel Worksheet Functions 8 June 13th 07 06:11 PM
sumproduct with 0/blank cells Matt Excel Worksheet Functions 4 December 15th 05 09:26 PM


All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"