Purpose
Return value
Syntax
=MUNIT(dimension)
- dimension - An integer for the size of the unit matrix.
Using the MUNIT function
The MUNIT function returns a unit matrix for a given dimension, n , with a size of n x n . The unit matrix is also called the identity matrix. The MUNIT function takes just one argument, dimension , which should be a positive integer. The resulting matrix contains ones on the main diagonal and zeros in every other position.
Examples
The formula in D5 returns a 3 x 3 unit matrix :
=MUNIT(3) // 3 x 3
With 3 given for dimension, the MUNIT function returns a 3 by 3 array like this:
| 1 | 0 | 0 |
|---|---|---|
| 0 | 1 | 0 |
| 0 | 0 | 1 |
The formula in J5 returns a 5 x 5 unit matrix.
=MUNIT(5) // 5 x 5
With 5 given for dimension, the MUNIT function returns a 5 by 5 array like this:
| 1 | 0 | 0 | 0 | 0 |
|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 0 | 0 | 1 |
Array syntax
The MUNIT function returns an array of values. In Excel 365 , where dynamic arrays are native , you can use the MUNIT function without any special handling – MUNIT will return an array of values that spill directly into cells in the worksheet.
In versions of Excel prior to Excel 365, you need to enter MUNIT enter as a multi-cell array formula to display results directly on the worksheet. To do this, make a selection of the right size, and enter MUNIT with control + shift + enter .
Notes
- Dimension must be greater than zero.
- If dimension is zero or less than zero, MUNIT will return the #VALUE error.
- A unit matrix is also called an identity matrix .
Purpose
Return value
Syntax
=ODD(number)
- number - The number to round up to an odd integer.
Using the ODD function
The ODD function rounds numbers up to the next odd integer. ODD always rounds numbers away from zero, so positive numbers become larger and negative numbers become smaller (i.e. more negative).
ODD takes just one argument , number , which should be a numeric value. With positive numbers, ODD rounds number up to the next odd integer. With negative values, ODD rounds number down away from zero to the next odd negative integer. With one (1) and numbers that are already odd integers, number is unchanged.
Examples
The ODD function rounds positive numbers up to the next odd integer:
=ODD(2) // returns 3
=ODD(5.1) // returns 7
Negative numbers are rounded away from zero to the next odd integer:
=ODD(-2) // returns -3
=ODD(-5.1) // returns -7
The number 1 and numbers that are already odd integers are unaffected:
=ODD(3) // returns 3
=ODD(1) // returns 1
=ODD(-3) // returns -3
To round numbers up to the next even integer, see the EVEN function .