This article describes the formula syntax and usage of the MUNIT function in Excel.
Returns the unit matrix for the specified dimension.
The MUNIT function syntax has the following arguments.
Dimension Required. Dimension is an integer specifying the dimension of the unit matrix that you want to return. It returns an array. The dimension has to be greater than zero.
MUNIT uses the following equation:
If dimension is a value that’s equal to or smaller than zero (0), MUNIT returns the #VALUE! error value.
The following example shows the results of the MUNIT function in a 3X3 matrix below, in cells A1:C3. To return a 3x3 matrix, the formula in C2:E4 needs to be entered as an array by pressing Ctrl+Shift+Enter.
Note: If you have a current version of Office 365, then you can simply enter the formula in the top left-cell of the output range and then press ENTER to confirm the formula as a dynamic array formula. Otherwise, the formula must be entered as a legacy array formula by first selecting the output range, entering the formula in the top-left-cell of the output range, and then pressing CTRL+SHIFT+ENTER to confirm it. Excel inserts curly brackets at the beginning and end of the formula for you. For more information on array formulas, see Guidelines and examples of array formulas.
MUNIT can be used in line with other matrix functions, such as MMULT.