Using the Excel MUNIT Function

Summary
The Excel MUNIT function returns the unit matrix for the specified dimension, n, with a size of n x n. The output will have 1s on the diagonal and 0s in the remaining spaces.Syntax
=MUNIT (dimension)Syntax Breakdown
DimensionRequired. An integer specifying the dimension of the unit matrix you want to return. Dimension must be > 0. The output is an array.
Usage Notes
MUNIT returns a unit matrix for specified dimensions. The function must be entered as an array formula by pressing Control + Shift + Enter as opposed to simply Enter.The function returns the #VALUE! error if the dimension argument is less than or equal to zero.