Math & Trig

MUNIT Function in Excel

Returns the unit matrix or the specified dimension.

Syntax

  • =MUNIT(dimension)

Arguments

  • dimension (required): Size of the identity matrix to return

Examples

  • =MUNIT(3) - 3x3 identity matrix - Result: {{1,0,0};{0,1,0};{0,0,1}}
  • =MUNIT(2) - 2x2 identity matrix - Result: {{1,0};{0,1}}

MUNIT in reporting workflows

  • Use absolute references when copying formulas across rows.
  • For conditional totals see [SUMIF](/functions/sumif/) and [SUMIFS](/functions/sumifs/).
  • Filtered lists may need [SUBTOTAL](/functions/subtotal/) instead of SUM on visible cells only.

Common errors

  • #VALUE! if dimension is not a positive integer

Use cases

  • Matrix operations
  • Linear algebra
  • Identity matrix creation

Frequently asked questions

  • What is MUNIT (identity matrix) used for? MUNIT creates an identity matrix - 1s on the diagonal, 0s elsewhere. The identity matrix is the 'neutral element' for matrix multiplication: any matrix times identity equals itself. Used in linear algebra and as a starting point for transformations.
  • How do I verify a matrix inverse is correct? Multiply the matrix by its inverse using MMULT. The result should be the identity matrix: =MMULT(A, MINVERSE(A)) should equal =MUNIT(n) where n is the matrix dimension. Small rounding errors may occur.
  • Can I create a non-square identity-like matrix? MUNIT only creates square matrices. For rectangular matrices with 1s on diagonal, use a formula like =IF(ROW(A1:C3)=COLUMN(A1:C3),1,0) or combine SEQUENCE with conditional logic.

Editorial review

  • Reviewed by Excel.Directory Editorial Team. Updated May 2026.