Practice free

MUNIT function

MUNIT builds an identity matrix of the size you choose and spills it across the sheet, with 1s on the diagonal and 0s elsewhere. It is used in matrix calculations.

Example

Read it as a sentence: build a 4 by 4 identity grid with 1s on the diagonal and 0s elsewhere, then add up all its cells, which gives 4.

Practice this in the app

Syntax

MUNIT(dimension)

dimension (required)
The number of rows and columns of the identity matrix.

Returns: An identity matrix (1s on the diagonal, 0s elsewhere) that spills.

One MUNIT formula can fill more than one cell. When the result has several values, they spill into the cells below or to the right of the formula.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=MUNIT(3) 1 3
=MUNIT(1) 1 1
=MUNIT(2.9) 1 2.9 truncates
=MUNIT("2") 1 Text number
=MUNIT({2,3}) 1 Array arg
=MUNIT(0) #VALUE! 0
=MUNIT(-1) #VALUE! -1
=MUNIT("a") #VALUE! Text

Watch out for

  • Dimension below 1 returns #VALUE!.

Where it works

Excel
MUNIT arrived in Excel 2013. Older versions do not have it.
Google Sheets
Same name, same behaviour for everyday use.

Part of Math and trig functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .