Replace a Hard-Coded Constant in an Excel Formula
Question details
Move a constant out of an Excel formula so it can be changed or hidden without editing every formula.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Several formulas use the same fixed value, which may need to be updated later.
- Observed behavior
- The shared value is stored outside the formulas and can be changed in one place.
Identify the constant you want to move and choose an unused cell for it. If formulas are copied across rows or columns, use an absolute reference to keep them pointing to that cell.
Store the constant in a cell and use an absolute reference
Use this method when multiple formulas should refer to the same value.
Select an unused cell, such as K2, and enter the constant currently embedded in your formulas.
Select a formula cell and replace the chosen constant with $K$2. For example, use =((D4-C4)*8)+$K$2 when K2 holds the value added to the result.
Edit the other formulas to use $K$2, or use the fill handle to copy the updated formula where appropriate. The dollar signs keep the reference fixed when copied.
Edit K2 to update formulas that reference it. To hide it from view, right-click the K column heading and select Hide; hiding a column does not secure its contents.

Name the constant cell for a more readable formula
Use a named cell when you want the formula to describe what the constant represents.
Manage shared formula constants in WPS Spreadsheet
Use a separate cell in WPS Spreadsheet to hold a shared constant, then reference it from your formulas so you can update the value in one place.
- 1. Open your workbook: Open WPS Spreadsheet and use Open to select your Excel workbook.
- 2. Enter the constant: Select an unused cell, such as K2, and enter the value you want formulas to share.
- 3. Reference the cell: Select a formula cell and replace the hard-coded value with $K$2, for example =((D4-C4)*8)+$K$2.
- 4. Apply and save: Update the other relevant formulas, check their results, and select Save to keep your changes.

Frequently Asked Questions
Why should I use $K$2 instead of K2?
The dollar signs make both the column and row absolute, so the reference remains K2 when you copy the formula to another cell.
Can I put the constant on another worksheet?
Yes. Enter the value on the other sheet and reference it with the sheet name, such as =((D4-C4)*8)+Sheet2!$K$2.
How do I make a formula easier to read?
Select the constant cell, enter a name such as BaseHrs in the Name Box beside the formula bar, and use that name in the formula instead of the cell reference.
Does hiding the constant prevent others from seeing it?
No. Right-clicking a column heading and selecting Hide removes it from view, but users can unhide it. Hiding is not a security measure.
What if the value changes based on several conditions?
Put the applicable values and conditions in a lookup table, then use a lookup formula to return the appropriate value instead of referencing a single constant cell.




