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?
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
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.
 

JMCC

New Member
Joined
May 4, 2010
Messages
8
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.
 

Forum statistics

Threads
1,082,017
Messages
5,362,695
Members
400,686
Latest member
Aakash

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top