# Excel MUNIT Function

The Excel MUNIT function returns a unit matrix for a given dimension, n, with a size of n x n. This resulting matrix contains ones on the main diagonal and zeros in every other position.

**dimension**- An integer for the size of the unit matrix.

The MUNIT function returns a unit matrix for a given dimension, n, with a size of n x n. This resulting matrix contains ones on the main diagonal and zeros in every other position. For example, with the formula:

=MUNIT(5)

The MUNIT function returns a 5 by 5 array like this:

1 | 0 | 0 | 0 | 0 |

0 | 1 | 0 | 0 | 0 |

0 | 0 | 1 | 0 | 0 |

0 | 0 | 0 | 1 | 0 |

0 | 0 | 0 | 0 | 1 |

Because MUNIT returns an array, you must enter as a multi-cell array formula to display directly on the worksheet. To do this, make a selection or the right size, and enter MUNIT with control + shift + enter.

### Notes

- The 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

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.