MUNIT Function

MUNIT Function

MUNIT Function

Returns an identity matrix for the size you specify. This is useful when you need a neutral matrix for testing or matrix setup.

ExcelClash Team
PUBLISHED

Summary

MUNIT returns an identity matrix for the dimension you choose. An identity matrix has 1s on the main diagonal and 0s everywhere else.

This matters because the identity matrix plays the same role in matrix math that the number 1 plays in normal multiplication. When the dimensions match, multiplying a matrix by the identity matrix leaves the original matrix unchanged.

Purpose

Create an identity matrix

Useful for testing matrix formulas, checking inverses, and building matrix examples.

Return Value

A square array

The result spills to an n by n range based on the dimension you supply.

Syntax

=MUNIT(dimension)

The dimension must be greater than 0. Microsoft notes that MUNIT returns #VALUE! if the dimension is 0 or negative.

Arguments

  • dimension - Required. A positive integer that sets both the row count and the column count.

MUNIT vs Other Matrix Functions

MUNIT does not calculate with an existing matrix. It creates a clean reference matrix that other functions can work with.

Function Main job Returns Use it when
MUNIT Creates an identity matrix An array You need a neutral matrix of a certain size
MMULT Multiplies matrices An array You want to test the identity property or combine matrices
MINVERSE Finds an inverse An array You want to compare the product against an identity matrix
MDETERM Finds the determinant One number You are checking whether an inverse should exist

Using MUNIT

The easiest use is teaching yourself the pattern of an identity matrix. Once you see the diagonal of 1s and the surrounding 0s, it becomes much easier to understand why it behaves like a neutral matrix in multiplication.

It is also useful in real matrix work. After using MINVERSE, you can multiply the original matrix by the inverse with MMULT and compare that result to MUNIT. If the shapes match and the values are close to the identity pattern, the inverse step probably worked. In modern Excel the result spills automatically, while older versions require legacy array entry.

Example 1 - Generate a 2x2 identity matrix

This is the cleanest starting example. The result is a 2x2 grid with 1s on the diagonal.

=MUNIT(2)
Check Answer
Challenge #1
Target: Sheet1!F1
2x2 Identity Grid

Generate a 2x2 identity matrix. Formula: =MUNIT(2).

Example 2 - Generate a 3x3 identity matrix

Changing the dimension changes the whole size of the output because identity matrices are always square.

=MUNIT(3)
Check Answer
Challenge #2
Target: Sheet1!F2
3x3 Matrix Baseline

Generate a 3x3 identity matrix for testing. Formula: =MUNIT(3).

Example 3 - Show that identity leaves a matrix unchanged

If the dimensions match, multiplying by the identity matrix gives you the original matrix back.

=MMULT(B2:C3,MUNIT(2))
Check Answer
Challenge #3
Target: Sheet1!F3
Neutral Element Proof

Multiply B2:C3 by MUNIT(2). The result should be B2:C3. Formula: =MMULT(B2:C3, MUNIT(2)).

Example 4 - Make the size dynamic

Using a cell reference lets you resize the identity matrix without rewriting the formula.

=MUNIT(G2)
Check Answer
Challenge #4
Target: Sheet1!F4
Dynamic Size Control

Generate an identity matrix based on the dimension in G2. Formula: =MUNIT(G2).

Conclusion Recap

  • Main job: MUNIT creates an identity matrix.
  • Pattern: 1s on the main diagonal and 0s elsewhere.
  • Input rule: The dimension must be a positive number.
  • Useful check: MMULT(matrix, MUNIT(n)) should return the original matrix when the sizes match.
  • Common error: #VALUE! appears when the dimension is 0 or negative.
Tactical Arena
Select Scenario:
Share MUNIT Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.