Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Circular Error using MAX fnc

A B C D
Cur Prchs Prev Cur
Prc Prc Max Max
==== ==== ==== ====
10 8 11 11
12 13 13 13
15 12 13 15


Col A, Current Price, changes daily
Col B, Purchase price is constant
Col C, Previous Max from yesterday
Col D, Current Max = MAX(A,B,C)

If C is less than D, then Copy D to C
Using Excel functions, this results in a circular error
The solution is a piece of cake in Fortran (remember that?), but my
VBA isn't up to it.
Help!!!

- bud -


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Circular Error using MAX fnc

Let me guess, you tried using C1=IF(C1<D1,D1,C1) right?
The reason you get an error is that Excel worksheet
functions work like algebra, not like program code, so
A=A+1 is algbraically impossible. However, there is a
solution to allow circular references to work without
creating an error. Go to the Tools menu and select
Options, click the Calculations tab, then check the
Iterations check box.

But then another problem arrises. As soon as the formula
in D recalculates, so does the formula in C, so C will
always be greater than or equal to D. OK, so to prevent
this, then you will have to turn automatic calculations
off; again from Tools/Options/Calculation but check Manual
this time. Also, by default Excel calculates everything
when you save, so you can deselect this option from the
same place.

Now you will need a way to recalculate D without affecting
C when the value in column A changes. Add this to you
worksheet's code module (right-click the worksheet tab,
click View Code, paste this)

Private Sub Worksheet_Change(ByVal Target As Range)
Application.Calculation = xlCalculationManual
If Target.Column = 1 Then
Range("D:D").Calculate
End If
End Sub

And even with this done, it's prone to problems because if
a full recalculation is done at any time after the sheet
is open, C will be equal to or greater than D.

It may be easier to simply copy the values in D manually
over to C at the beginning of the day and forget
everything I mentioned above.




-----Original Message-----
A B C D
Cur Prchs Prev Cur
Prc Prc Max Max
==== ==== ==== ====
10 8 11 11
12 13 13 13
15 12 13 15


Col A, Current Price, changes daily
Col B, Purchase price is constant
Col C, Previous Max from yesterday
Col D, Current Max = MAX(A,B,C)

If C is less than D, then Copy D to C
Using Excel functions, this results in a circular error
The solution is a piece of cake in Fortran (remember

that?), but my
VBA isn't up to it.
Help!!!

- bud -


.

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
Circular Error Johnnie[_2_] Excel Worksheet Functions 2 July 13th 09 06:03 PM
circular error gavin New Users to Excel 7 February 1st 08 08:57 PM
Circular Refernce error Robthemanbob Excel Discussion (Misc queries) 3 August 28th 06 06:14 PM
Circular Reference error... Regnab Excel Discussion (Misc queries) 0 May 22nd 06 01:23 PM
Turning off Circular Error Help eider Excel Discussion (Misc queries) 2 July 28th 05 11:06 PM


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