Find Max in changing data

kanga85

New Member
Joined
Nov 7, 2019
Messages
4
In a excel sheet I have in column A a list of items, in column B a list of corresponding values. These values are updated daily over the course of a year. In column C I would like a list of the max value listed in column B over the course of time.

I have tried putting the current MAX value into a dummy column D, and then trying to put the MAX of B and D into C, but run into circular problems.

Should be easy, and any help would be appreciated.

Thanks
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, cel As Range
Set rng = Intersect(Target, [B:B])
If Not rng Is Nothing Then
    Application.EnableEvents = False
    For Each cel In rng
        If cel(1, 2) < cel Then cel(1, 2) = cel.Value
    Next
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, cel As Range
Set rng = Intersect(Target, [B:B])
If Not rng Is Nothing Then
    Application.EnableEvents = False
    For Each cel In rng
        If cel(1, 2) < cel Then cel(1, 2) = cel.Value
    Next
    Application.EnableEvents = True
End If
End Sub


Thanks for your rapid reply. But I was wondering whether this could be done without a macro.
 
Upvote 0
Thanks for your rapid reply. But I was wondering whether this could be done without a macro.
Try this :

C1 : =IF(B1>D1,B1,D1)

D1 : =MAX(B1:C1)

You will have to enable iterative calculations in Excel options.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,703
Messages
6,173,972
Members
452,540
Latest member
haasro02

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top