How to use the FIXED function
What is the FIXED function?
The FIXED function rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text.
1. Introduction
How to round numbers?
Rounding is a method to simplify a number by reducing its digits while keeping its approximate value close to the original value.
There are a few common ways to round:
- Round to a set number of decimal places, rounding 2.13579 to 2 decimal places gives 2.14.
- Round up or down to the nearest integer, rounding up 2.3 gives 3. Rounding down 2.3 gives 2.
- Round to a set increment, rounding to the nearest 10 rounds 17 to 20.
- Round to significant figures, rounding 2.333 to 3 significant figures gives 2.33.
When rounding, look at the first digit after where you want to round. If it's 5 or more, round up. If less than 5, round down. Rounding makes numbers cleaner and easier to work with in many everyday situations, however, they may also cause rounding errors like rounded values can compound errors. Rounding measurements and constants may reduces precision. It is better to round numbers after performing calculations than before.
What is a decimal place?
A decimal place refers to each position held by a digit in a number. The first decimal place is the tenths place (1/10), the second is the hundreds place (1/100) and so on.
What is a comma?
Commas are frequently used in large numbers to help read and interpret the values easier. Commas separate thousands place values in large numbers. For example:
- 10,000 - ten thousand
- 100,000 - one hundred thousand
- 1,000,000 - one million
The comma creates groups of three digits, making it easier to count the zeroes and understand the scale.
In decimal numbers with both whole and fractional parts, commas separate the whole number groups of three digits. For example:
- 3,421.256
- 102,734,221.985
The third argument [no_commas] determines if commas will be displayed or not. The image above shows the difference in cells C3 and C4.
What is an integer?
An integer is a whole number that can be positive, negative, or zero, but not a fraction or decimal.
What other Excel functions round numbers?
ROUND | Rounds a number to a specified number of digits |
ROUNDUP | Rounds a number up, away from zero |
ROUNDDOWN | Rounds a number down, towards zero |
MROUND | Rounds a number to the nearest multiple of a specified value |
CEILING | Rounds a number up to its nearest multiple. |
ODD | Returns number rounded up to the nearest odd integer. |
EVEN | Rounds a number up to the nearest even whole number. |
FIXED | Rounds a number to the specified number of decimals, lets you ignore comma separators. |
2. Syntax
FIXED(number, [decimals], [no_commas])
number | Required. The number you want to round and convert to text. |
[decimals] | Optional. The number of digits to the right of the decimal point. Negative numbers to the left of the decimal point. |
[no_commas] | Optional. Default value is FALSE. TRUE returns no commas in text string. |
3. Example 1
This example demonstrates how the FIXED function works, the image above shows the arguments in cells B3:B4 and the results in cells C3:C4. Column D displays the formulas used.
The first number in cell B3 is 34.721. The arguments in cell C3 are:
- number - B3 (a cell reference to the value we want to round)
- [decimals] - 1 (the number of decimals we want to round to)
Formula in cell C3:
The result in cell C3 is 34.7. Value 34.721 is rounded to 34.7 based on 1 decimal.
The second number in cell B4 is -15631.053. The arguments in cell C4 are:
- number: B3 (a cell reference to the value we want to round)
- [decimals]: -2 (the number of decimals we want to round to)
- [no_commas]: default:FALSE if omitted (show commas in text string)
Note that the [decimals] argument is a negative integer meaning the numerical value is rounded to the specified number left of the decimal point.
Formula in cell C4:
The formula in cell C4 returns -15,600 which is the rounded values to the nearest hundred based on this numerical value: -15631.053 Two decimals to the left rounds the number to the nearest hundred.
4. Example 2
The opposite side in a right triangle is 4.5 units, the adjacent side has equal length. What is the hypotenuse with three decimals?
Pythagoras theorem which states that the squared hypotenuse is equal to the sum of the squared opposite side (a) and the adjacent side (b).
c2 = a2 + b2
b = 4.5
a = 4.5
c2 = 4.52 + 4.52
c2 = 20.25 +20.25
c = √40.50
c = 6.36396103067893
Formula in cell C18:
The formula in cell C18 calculates the length of the hypotenuse.
Arguments:
- number: (4.5^2+4.5^2)^0.5
- [decimals]: 3
- [no_commas]: default:FALSE if omitted (show commas in text string)
Formula in cell C20:
The formula in cell C20 returns 6.364 which is the rounded values with three decimals based on this numerical value: 6.36396103067893
The chart above displays a right triangle with the length of the opposite side equal to 4.5 and the adjacent side equal to 4.5 as well. The hypotenuse named c is the value we need to calculate.
5. Example 3
A bacterial colony starts with 1000 cells and the population doubles every hour. What will be the population after 5.5 hours, round the number to two decimals?
The formula for exponential growth is:
A = P * (1 + r)t
Where:
- A = Final amount or population after a certain time
- P = Initial amount or population (starting value)
- r = Growth rate (per unit of time)
- t = Time elapsed (in the same units as the growth rate)
The POWER function allows us to calculate exponential growth in Excel, there is also the caret character ^ that also works in Excel formulas.
The POWER function calculates a number raised to a power.
Function syntax: POWER(number, power)
Here are the arguments to the FIXED function:
- number: 1000*POWER(2,5.5)
- [decimals]: 2
- [no_commas]: TRUE (This prevents commas in the output string)
Formula in cell C21:
The formula in cell C21 returns 45254.83 which represents the bacteria population after 5.5 hours with an initial population of 1000.
Explaining the formula
Step 1 - Model the math formula
Population = start * kx
start - initial population
k - growth
x - hours
Step 2 - Evaluate math formula
1000*POWER(2,5.5)
becomes 1000 * 45.254833995939
and returns 45254.833995939
Step 3 - Round the nearest specified decimals
FIXED(1000*POWER(2,5.5),2,TRUE)
becomes
FIXED(45254.833995939,2,TRUE)
and returns 45254.83
Functions in 'Math and trigonometry' category
The FIXED function function is one of 62 functions in the 'Math and trigonometry' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form