Suppose that a person (let us refer to the person as T for Testator) wants to leave someone (who we will refer to as B for beneficiary) say $100K in a will, which is well below the value of T's current assets. But by the time T dies, the estate may be worth much less, perhaps even less than the $100K. Could B say something like "I leave to B the lesser of $100K or 25% of the estate".... Is there a standard for how to express this?
The best practice is to regularly review and revise a will, and if the size of the prospective estate has changed significantly, change specific bequests as needed. (Changes should also be made if births and deaths make changes a good idea.) But this is a counsel of perfection in many cases. Many people find it hard enough to make a will at all, much less review it on a regular basis. Moreover the Testator (T) might fear that s/he will not be competent to make a new will when such action is needed. This is a reasonable concern for T to have.
A bequest using a formula such as "I leave to B the lesser of $100K or 25% of the estate" is perfectly valid. One should be careful that bequests specifying percentages of the estate do not add up to more than 100%. (It is fine if they are less. The residuary legatee(s) get whatever is left over.)
A comment suggests that the will be drafted by a lawyer. While this is always possible, if the will is otherwise relatively uncomplicated, there is not the slightest need for a lawyer. If this is in the US, several well respected firms sell software that will draft a perfectly valid will in response to a series of plain language questions, with language tailored to the specific state of residence. Quite a few lawyers actually use such programs and make minor changes to the output for basic wills. I used one to draft my own will. I suspect that such software is available for other countries, but I cannot verify that.