Exceljet

Quick, clean, and to the point

Excel MUNIT Function

Excel MUNIT function
Summary 

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.

Purpose 
Return unit matrix for a given dimension
Return value 
Unix matrix of size n x n
Syntax 
=MUNIT (dimension)
Arguments 
  • dimension - An integer for the size of the unit matrix.
Usage notes 

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

  1. The dimension must be greater than zero
  2. If dimension is zero or less than zero, MUNIT will return the #VALUE error
  3. 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.