What Is Hard Coding in Excel?

By Timothy Smithee

Hard coding is a term used in computer programming. In Excel, it means using specific amounts in formulas or code instead of using calculated or referenced amounts. For example, if the actual amount of a sales tax is included in a formula, the tax amount is hard coded. If the formula references a cell that contains the sale tax amount, the tax amount is not hard coded. There are advantages and disadvantages to hard coding.

Advantages of Hard Coding

Hard coding is quick and easy. To write a formula that determines the tax on an item, you multiply the item by the tax amount. To highlight a row that contains unusual data, you highlight the row using the Fill button on the toolbar. For smaller or limited use spreadsheets, hard coding is the best approach.

Disadvantages of Hard Coding

Hard coding makes spreadsheets less flexible and is time-consuming on larger spreadsheets. If an amount that might change, like sales tax, is hard coded into formulas, updating the amount requires locating and updating every formula that contains that amount. If the amount was referenced instead of hard coded, updating the amount would require only updating the referenced cell. If there are many rows that need to be highlighted due to unusual data, hard coding requires manually locating and updating each affected row. For larger and more complex spreadsheets, hard coding should be avoided.