Using the Excel MUNIT Function
SummaryThe 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.
Required. An integer specifying the dimension of the unit matrix you want to return. Dimension must be > 0. The output is an array.
Usage NotesMUNIT 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.