DISCOVER

# What is hard coding in Excel?

Excel spreadsheets allow you to store and manipulate data values. The data values in an Excel spreadsheet are organised into rows and columns of cells. Each cell contains a single data value. This value can be hard-coded into the spreadsheet or calculated using a function, which may involve referencing other cells in the spreadsheet. Functions and calculations in Excel can also include hard-coded values. There are a number of considerations when using hard-coding in Excel spreadsheet cells.

## Values

In an Excel spreadsheet cell, you can enter a function in which a value is calculated. Often, this function or calculation will involve references to other cells in the spreadsheet or hard-coded values. For example, in one cell you could store a number representing the income for an organisation, with another storing the percentage rate for VAT. In a third cell, you could calculate the VAT on the income value using a calculation on the first two cells. The value in the third calculated cell would be a formula, while the values in the other two cells may be hard-coded. A hard-coded cell is one in which the spreadsheet user has typed the value in directly. The value may be one of various different types, but when the term "hard-coded" is involved it will typically be numerical.

## Uses

Most Excel spreadsheets contain a mix of hard-coded values and values calculated using functions and references to other cells. The user needs to choose whether to include a hard-coded value in a particular cell depending on the needs of the spreadsheet. A calculation or function in a cell may also include a hard-coded value. For example, rather than storing the VAT rate in a dedicated cell as a single hard-coded value, the cell in which the VAT calculation appears could itself include the VAT rate as a hard-coded value as in the following example: \=A1*0.2