MUNIT Function

Excel 365, Excel 2019+

Summary

The MUNIT function generates an identity matrix of specified dimensions, essential for matrix algebra operations in Excel. It creates a square matrix with ones on the main diagonal and zeros elsewhere, serving as the multiplicative identity in matrix multiplication.

Syntax

MUNIT(dimension)

Parameters

Parameter Type Required Description
dimension Integer Yes A positive integer greater than zero that determines the dimension of the square unit matrix to return

Using the MUNIT Function

MUNIT is crucial for matrix mathematics in Excel, particularly when performing matrix multiplications with MMULT. The identity matrix acts as the '1' in matrix algebra - multiplying any matrix by an identity matrix of appropriate dimensions returns the original matrix unchanged.

Common MUNIT Examples

Create 3x3 Identity Matrix

=MUNIT(3)

Returns a 3x3 identity matrix with 1s on the diagonal and 0s elsewhere, spilling into 9 cells as a dynamic array.

Verify Matrix Identity Property

=MMULT(MUNIT(2),A1:B2)

Multiplies a 2x2 identity matrix by any 2x2 matrix, returning the original matrix unchanged.

Frequently Asked Questions

MUNIT returns a #VALUE! error if the dimension is less than or equal to zero.

Yes, MUNIT returns a dynamic array that automatically spills into the required range in Excel 365 and Excel 2021.

Common Errors and Solutions

#VALUE! error

Cause: Dimension argument is zero or negative

Solution: Use a positive integer greater than zero for the dimension parameter

Notes

  • Identity matrix has ones only on the main diagonal (from top-left to bottom-right)
  • All off-diagonal elements are zero
  • MUNIT(n) creates an n × n square matrix
  • Perfect companion for MMULT function
  • Available only in modern Excel versions supporting dynamic arrays

Compatibility

Available in: Excel 365, Excel 2019, Excel 2021

Not available in: Excel 2016 and earlier versions

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 365, Excel 2019+