LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 683
Default Circular Reference Peculiarity

Hello,

I use circular references all the time without issues, however Im having
trouble when using user-defined functions in conjunction with circular
references.

Take the following simplified example:

Cell1: Revenue = 1000000 + Expenses * 3%

Cell2: Expenses = 700000 + Revenue * 2%

Where "Revenue" and "Expenses" are named ranges

The above formula works just fine assuming the calculation settings are
setup to allow circular references, but changing the formula to the following
creates problems:

Cell1: Revenue = RoundToNearest(1000000 + Expenses * 3%,5000)

Cell2: Expenses = 700000 + Revenue * 2%

Where RoundToNearest is a simple user-defined formula I created
to round numbers that's a bit more flexible than Excel's built-in Round
function (in the example above Revenue gets rounded to the
nearest $5,000). The error, however, occurs regardless of which
user-defined function I use.

When I open the worksheet containing the second example above, Cell1
(Revenue) and Cell2 (Expenses) contain #NAME? and #VALUE! respectively.
Oddly enough, if I delete Cell1 and press undo the error fixes itself.
However, I have to perform the delete and undo procedure every time I open
the file.

Does anyone have any thoughts on how to correct this problem? Thanks!



PS: The error occurs regardless of what user-defined function I use so I
don't think the error is specific to my RoundToNearest function.
Nevertheless, here's the function code:

Function RoundToNearest(x, Optional Threshold = 1) As Double

RoundToNearest = WorksheetFunction.Round(x / Threshold, 0) * Threshold

End Function
 
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
Circular Reference [email protected] Excel Worksheet Functions 4 September 13th 09 04:59 PM
Circular reference help! nick Excel Discussion (Misc queries) 4 March 7th 06 08:07 PM
'circular reference' Rathika Excel Discussion (Misc queries) 2 January 26th 06 04:24 AM
Circular reference Pat Excel Discussion (Misc queries) 2 January 19th 05 05:52 AM
Circular Reference Tom Ogilvy Excel Programming 0 August 4th 04 06:50 PM


All times are GMT +1. The time now is 09:24 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"