The Excel MUNIT Function

Related Functions:
MMULT
MDETERM
MINVERSE

Function Description

The Excel MUNIT function returns the unit matrix for a specified dimension.

Note: the Munit function was only introduced in Excel 2013 and so is not available in earlier versions of Excel.

The syntax of the function is:

MUNIT( dimension )

where dimension argument is an integer value that specifies the dimension of the unit matrix. This value must be greater than 0.

Note: As the Excel Munit function returns an array of values, the function must be entered as an Array Formula.

Inputting Array Formulas

To input an array formula, you need to first highlight the range of cells that the function is to be entered into. Type the function into the first cell of the range, and press Ctrl + Shift + Enter.

See the Excel Array Formulas page for further details.

Munit Function Example

The spreadsheet below shows the Munit function, used to input the 4x4 unit matrix into cells A1-D4:

As displayed in the formula bar, the formula for this is:

=MUNIT( 4 )

The curly braces { } around the formula indicate that it has been entered as an Array Formula.

Example of the Excel Munit Function

For further details and examples of the Excel Munit function, see the Microsoft Office website.


Munit Function Errors

If you get an error from the Excel Munit function, this is likely to be one of the following:

Common Errors
#VALUE! - Occurs if the dimension argument is less than or equal to zero, or is not recognised as a numeric value.
#N/A -

Occurs in cells outside the range of the resulting matrix.

For example, if, in the example above, we had highlighted cells A1-E4 before entering the Munit function, the 'additional' cells, E1-E4 are not part of the resulting matrix. Therefore, these cells will display the #N/A error.

Be aware also that if, when you enter the Munit function, you don't highlight the entire range of cells that is needed to display the resulting matrix, Excel will just show the part of the result that fits into the highlighted range. There will be no error message to let you know that your highlighted range is not big enough.

This will also be the case if you fail to enter the formula as an array formula - the cell which you enter the formula into will just show you the first entry of the resulting matrix.