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

Syntax

MUNIT(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:

Munit equation

Remarks

  • If dimension is a value that’s equal to or smaller than zero (0), MUNIT returns the #VALUE! error value.

Examples

The following example shows the results of the MUNIT function in a 3X3 matrix below, in cells A1:C3.

Note: If you have a current version of Microsoft 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 (A1:C3 in this case), 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.

An example of MUNIT function

MUNIT can be used in line with other matrix functions, such as MMULT.

An example of MUNIT function

Need more help?

You can always ask an expert in the Excel Tech Community or get support in Communities.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.