Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default SUM() of empty dynamic named range returns #N/A

I have a cell with =SUM(CamperRev) where CamperRev is a dynamically
named range containing contribution amounts. This works fine if there
are any contributions, but displays #N/A if there are not.

I worked around this with
=IF(ISNUMBER(SUM(CamperRev)),SUM(CamperRev),"") but was wondering if
there is a better way.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default SUM() of empty dynamic named range returns #N/A

=sum() ignores text and empty cells.

So if you got an error from the =sum() function, that means that you have an
error in that range.

You could use an array formula:
=sum(if(isnumber(camperrev),camperrev))

This is an array formula. Hit ctrl-shift-enter instead of enter. If you do it
correctly, excel will wrap curly brackets {} around your formula. (don't type
them yourself.)

And camperrev can't refer to a whole column except in xl2007.

Or you could change the formula that is used in the cells in camperrev. Instead
of returning an error, you could return a 0 or an empty string ("").

Aviashn wrote:

I have a cell with =SUM(CamperRev) where CamperRev is a dynamically
named range containing contribution amounts. This works fine if there
are any contributions, but displays #N/A if there are not.

I worked around this with
=IF(ISNUMBER(SUM(CamperRev)),SUM(CamperRev),"") but was wondering if
there is a better way.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default SUM() of empty dynamic named range returns #N/A


Thanks for your response. The array formula is a superior solution, I
hadn't considerd using an array at all.

Your post (and solution) have still left me confused, however, about
the exact nature of the problem.

"=sum() ignores text and empty cells. So if you got an error from the
=sum() function, that means that you have an
error in that range. "
AND
"Or you could change the formula that is used in the cells in
camperrev."

All the cells are empty. No formulas or values. If a value is
entered it works fine.

"And camperrev can't refer to a whole column except in xl2007. "
camperrev refers to a dynamically named range using the following
formula:
=OFFSET(Contributions!$H$2,0,0,MATCH(1E+306,Contri butions!$H:$H,1),1)

As a result, the range is only as large as the amount of entries.

Perhaps the problem is that in this case the range object returns
Nothing?
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
Pass named range to user defined function returns #value! Ron Rosenfeld Excel Programming 0 November 10th 07 01:03 PM
Pass named range to user defined function returns #value! JMB Excel Programming 1 November 10th 07 12:24 PM
HLOOKUP using a named range returns #VALUE! MicheleO Excel Worksheet Functions 2 August 24th 06 06:06 PM
Trapping error from Empty Dynamic Named Range Casey[_105_] Excel Programming 5 June 13th 06 03:43 PM
Named range returns 1004 error Stu D. Excel Programming 0 September 3rd 04 09:37 AM


All times are GMT +1. The time now is 07:11 PM.

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"