ROW() within SUM() not working in named formula in Excel 97

JMCC

New Member
Joined
May 4, 2010
Messages
8
Excel is driving me crazy. I've been working on a formula in Excel 97 that ended up being pretty complex. To make it easier to read I started breaking it down into pieces using named formulas (Insert > Name > Define). Now I'm hitting a roadblock with Excel's handling of named formulas.

Basically, the ROW() function is not working when nested within the SUM() function in a named formula, and I have no idea why.

Here is my test data:
Excel Workbook
AB
1
2
3
42
53
64
75
8???
...


This is a small part of my overall formula that illustrates the specific problem I'm posting about. I'm using the constants 4 and -1 here to simplify the test. In my actual formula those values are calculated dynamically.

I'll refer to my named formula as "Daily_total".

Code:
*** 1 ***

Daily_total:
=SUM( OFFSET( B8, ( 4 - ROW() ), -1, 4 ) )

Formula in B8:
=Daily_total

Result: #VALUE!


*** 2 ***

Daily_total:
=SUM( OFFSET( B8, ( 4 - ROW( B8 ) ), -1, 4 ) )

Formula in B8:
=Daily_total

Result: #VALUE!


*** 3 ***

Daily_total:
N/A

Formula in B8:
=SUM( OFFSET( B8, ( 4 - ROW() ), -1, 4 ) )

Result: 14


*** 3 ***

Daily_total:
=SUM( OFFSET( B8, ( 4 - 8 ), -1, 4 ) )

Formula in B8:
=Daily_total

Result: 14


*** 4 ***

Daily_total:
=OFFSET( B8, ( 4 - ROW() ), -1, 4 )

Formula in B8:
=SUM( Daily_total )

Result: 14


Why is this happening?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try:

=SUM(OFFSET(B8,(4-MIN(ROW())),-1,4))

The ROW function returns an array like {8} which causes a problem when used in a named formula.
 
Upvote 0
Thanks a lot Andrew! That does indeed seem to have solved the problem. I don't completely get it, because I use ROW() in several places in the formula, and I only had to make the change you suggested in one place to get my formula to work. The ones I didn't have to change are like:

Code:
INDIRECT( ADDRESS( ( ROW() -1 ), COLUMN() ) )

Thank you, I don't think I ever would have figured that out. I'm still not clear on why it works differently in the named formula -- why the same formula put into a named formula or put directly in the cell produce different results, or why leaving SUM() out of the named formula and putting =SUM( Daily_total ) in the cell works.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top