Examples

The formula in D5 returns a 3 x 3 unit matrix : With 3 given for dimension, the MUNIT function returns a 3 by 3 array like this: The formula in J5 returns a 5 x 5 unit matrix.  With 5 given for dimension, the MUNIT function returns a 5 by 5 array like this:

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.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.