Modify a cell only if condition is satisfied

Copper Contributor

I want to fill a cell only if a condition is satisfied. If the condition is not fulfilled I don't want to modify the value it already had.

1 Reply

@dfernandez_00 How to implement that depends on ...

 

Is "the value it already had" some constant value?  Or is that value something that can always be derived from other cells that will never change?  If either of those, and if the value can be correctly recalculated every time the spreadsheet/range is recalculated while that condition (which you did not describe) is true, that can be accomplished with a formula.  (Can you be more specific?  Got an example?  Will you need very many cells to behave like that?)

 

But if you are expecting that cell to initially contain some user-entered value that you can't define, then code (VBA code) in a macro is probably required; that would also require saving the workbook as a macro-enabled workbook (*.xlsx, or an old version of an Excel workbook), and being prepared to handle security issues.