Yes. As simple as that but still puzzling to me
Yes. As simple as that but still puzzling to me
I'm sure there is a way to do this, however it will require VBA coding that is beyond my meager programming capabilities.
Hopefully, one our programming aces will have a solution to share with you.
Stand by...
Bruce
Bruce
The older I get, the better I used to be.
USA
Do you want to trap every local max/min, or just the overall max/min.
Here's a solution to trap the overall max/min that doesn't use VBA coding:
variable is input to cell a1
a2=if(a1>a2,a1,a2) finds the overall max
a3=if(a1<a3,a1,a3) finds overall min
because these formulas set up circular references, you need to go into the options dialog and check the box next to "Iteration" on the "Calculation" tab. It will only need one iteration, so I would set the max iterations to 1.
Mrshorty,
I have tried this approach and it doesnt make it. When the data stream ends the solution has to be converted to text or number. Up to that point MAX min() works with the same short comings. Your solution still relies on the loop and when one variable drops out the whole thing crashes.
Robk
Hello Kierco,
Here is a code routine that may prove helpful. Whenever the data stream changes the cells value, the worksheet will compare it against the previous Min and Max values. These values are stored on the worksheet. This way you always have the most current Min and Max values, regardless of the data stream's timing. You will have to provide the code that determines when the stream ends. At that time you can simply retrieve the Min and Max values from the worksheet.
Copy and Paste this code in the Worksheet where your data value will be stored. The code is set to capture the Value in "A1" with Min in "B2" and Max in "C2". You can easily change these in the code to match your needs
![]()
Private Sub Worksheet_Change(ByVal Target As Excel.Range) 'Track Min and Max Values of a Cell Dim ValCell Dim MinCell As Range Dim MaxCell As Range ValCell = "$A$2" Set MinCell = Range("B2") Set MaxCell = Range("C2") With Target If .Address = ValCell Then If MinCell.Value = "" And MaxCell.Value = "" Then MinCell.Value = Target.Value MaxCell.Value = Target.Value End If Select Case .Value Case Is >= MaxCell.Value MaxCell.Value = .Value Case Is <= MinCell.Value MinCell.Value = .Value End Select End If End With End Sub
If you have problems with the code or have any questions, contact me via e-mail at LeithRoss@aol.com.
Sincerely,
Leith Ross
Last edited by Leith Ross; 05-12-2005 at 06:35 AM.
My thanks to MrShorty and Leith for responding to my 'plea' for help on this one. Thanks, guys.
Bruce
I want to openly thank everyone who has helped get me to this point.
I will follow instructions and report back with my success and or frustrations. Ha
Again, many thanks to all.
kierco
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks