"ratcheting" a value in Excel

kenrperry

New Member
Joined
Jan 1, 2012
Messages
3
In Excel, I am trying to find a way to "ratchet up" the value in a cell. I want the value of the cell to never decrease, but to increase if the value of another cell is higher than the current value of this ratchetable cell. The other cell is automatically updated from the web daily and I am trying to track the highest ever value, thus the need to "ratchet up" the value in the ratcheted cell if the other cell is larger, but to not lower the ratcheted value if the other cell is lower.

ideas?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi and Welcome to the Board
Copy this into the sheet module, and adjust ranges to suit
Code:
Private Sub worksheet_change(ByVal target As Range)
Set target = Range("B1")
If Range("A1") < target Then Range("A1") = target
End Sub
 
Upvote 0
In Excel, I am trying to find a way to "ratchet up" the value in a cell. I want the value of the cell to never decrease, but to increase if the value of another cell is higher than the current value of this ratchetable cell. The other cell is automatically updated from the web daily and I am trying to track the highest ever value, thus the need to "ratchet up" the value in the ratcheted cell if the other cell is larger, but to not lower the ratcheted value if the other cell is lower.

ideas?
You can do this with a formula that uses a circular reference.

What version of Excel are you using?
 
Upvote 0
Perhaps this UDF with a formula like
=RatchetUp(A1)
Note that the Reset argument allows you to reset the value.
Code:
Function RatchetUp(testValue As Double, Optional Reset As Boolean = False) As Double
    RatchetUp = WorksheetFunction.Max(Val(Application.Caller.Text), testValue)
    If Reset Then RatchetUp = testValue
End Function
 
Upvote 0
Biff,

I have 2007 and would be interested in seeing how you get the circular reference to work please
 
Upvote 0
Biff,

I have 2007 and would be interested in seeing how you get the circular reference to work please
Do this before you enter the formula or you'll get warning messages...

Office button>Excel Options>Formulas>Calculation Options

Select: Enable iterative calculation
Maximum iterations: 1
OK out

Let's assume cell A2 is the input cell.

Enter this formula in B2:

=MAX(B2,A2)
 
Upvote 0

Forum statistics

Threads
1,216,115
Messages
6,128,915
Members
449,478
Latest member
Davenil

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