Contact

MUNIT in Excel: Create Identity Matrices and Check Matrix Products

Math and trigonometry Intermediate Microsoft Excel

Build Excel identity matrices with explicit array shapes, verify matrix multiplication and distinguish current spilling from legacy array entry.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: MUNIT returns a square identity matrix: ones on the main diagonal and zeros elsewhere. =MUNIT(3) has independently expected shape 3 rows by 3 columns. It is a matrix-valued formula, rather than a scalar count of three.

Availability and version history

  • Introduced: Microsoft marks the function as introduced in Excel 2013. Version-marker reference.
  • Availability: official help lists Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel 2024, Excel 2024 for Mac, Excel 2021, Excel 2021 for Mac, Excel 2019, Excel 2016.
  • Checked: October 14, 2026; official MUNIT reference. Documentation and independently calculated examples; no native Excel execution or broader platform certification.

Syntax and dimension rule

=MUNIT(dimension)

Microsoft requires a positive integer dimension and documents #VALUE! when it is zero or negative. The returned array has dimension² cells. The function’s Excel 2013 introduction marker establishes history; it does not mean every supported client uses the same array-entry workflow.

The examples use positive whole-number dimensions. Fractional/text coercion, excessive dimensions and every destination-client limitation are not certified here. English names and comma separators are shown.

Example 1: generate a three-by-three identity matrix

In a current Microsoft 365 client supporting dynamic arrays, enter =MUNIT(3) in A2 with A2:C4 clear. The expected result is:

A B C
1 0 0
0 1 0
0 0 1

These table headings identify output columns; the formula returns only the three numeric rows. The diagonal runs from the top-left to the bottom-right. All six off-diagonal entries are zero.

Microsoft’s help also describes legacy entry: select the intended 3×3 output range, enter the formula and confirm it as a legacy array using Ctrl+Shift+Enter in that desktop workflow. Do not type the surrounding array braces manually. The guide does not assume automatic spilling in every historical or web client.

Example 2: compare dimensions and cell counts

MUNIT(1) has one entry, 1. MUNIT(2) has four entries arranged as rows 1,0 and 0,1. MUNIT(4) has 16 entries, of which four are ones and 12 are zeros.

=SUM(MUNIT(4))

The independent expected sum is 4. In general, an n×n identity matrix has n diagonal ones, not n² ones. Selecting a too-small display area in a legacy workflow can conceal part of the intended array rather than changing its mathematical definition.

Advanced example: preserve a matrix through multiplication

Create H2:I3 with this numeric matrix:

H I
2 5
-1 4

Then use an appropriate 2×2 array-output workflow for:

=MMULT(H2:I3,MUNIT(2))
=MMULT(MUNIT(2),H2:I3)

Both independently expected outputs reproduce the original rows 2,5 and -1,4. The identity leaves the matrix unchanged on either side when dimensions are compatible.

MMULT performs matrix multiplication, not cell-by-cell multiplication. An identity matrix’s zeros suppress the unwanted cross terms, while each diagonal one preserves the corresponding row or column contribution.

Advanced example: scale the diagonal deliberately

=2*MUNIT(3)

Expected output has diagonal 2,2,2 and zeros elsewhere. It is not the identity matrix anymore; multiplying a compatible matrix by this scaled matrix doubles its entries rather than preserving them.

For the H2:I3 matrix, =MMULT(H2:I3,2*MUNIT(2)) has expected rows 4,10 and -2,8. A nonzero diagonal matrix can have a useful role without being an identity matrix.

Advanced check: multiply the identity by itself

=MMULT(MUNIT(3),MUNIT(3))

The independently expected output is the same 3×3 identity. Each diagonal result contains one product of ones; every off-diagonal result has only zero contributions. This small matrix multiplication is a transparent check of the model and array shape.

The output is not an inverse of an arbitrary input matrix. MUNIT takes a dimension, not a matrix to invert. Do not substitute it for an inverse calculation simply because multiplying an identity is easy to verify.

Errors and array troubleshooting

=MUNIT(0) and =MUNIT(-2) have vendor-documented expected error #VALUE!. The successful examples do not establish how a fractional dimension is converted, so supply an explicit positive integer.

Check the requested square shape, client array workflow and available output cells before interpreting a partial display. A dimension of three means nine output cells. No native Excel execution, universal spill behavior or extreme-size matrix performance is claimed.

References and verification

Worked inputs are fictional. Decimal answers are independently calculated mathematical expectations rounded to nine places, not captured native results. Extreme magnitudes, complete coercion matrices and cross-version numerical accuracy remain untested.