# The Excel MUNIT Function

Related Functions:
MMULT
MDETERM
MINVERSE

## Function Description

The Excel MUNIT function returns the unit matrix for a specified dimension.

Note: the Munit function was only introduced in Excel 2013 and so is not available in earlier versions of Excel.

The syntax of the function is:

MUNIT( dimension )

where dimension argument is an integer value that specifies the dimension of the unit matrix. This value must be greater than 0.

Note: As the Excel Munit function returns an array of values, the function must be entered as an Array Formula.

Inputting Array Formulas

To input an array formula, you need to first highlight the range of cells that the function is to be entered into. Type the function into the first cell of the range, and press Ctrl + Shift + Enter.

See the Excel Array Formulas page for further details.

## Munit Function Example

The spreadsheet below shows the Munit function, used to input the 4x4 unit matrix into cells A1-D4:

As displayed in the formula bar, the formula for this is:

=MUNIT( 4 )

The curly braces { } around the formula indicate that it has been entered as an Array Formula. For further details and examples of the Excel Munit function, see the Microsoft Office website.

## Munit Function Errors

If you get an error from the Excel Munit function, this is likely to be one of the following:

Common Errors
 #VALUE! - Occurs if the dimension argument is less than or equal to zero, or is not recognised as a numeric value. #N/A - Occurs in cells outside the range of the resulting matrix.For example, if, in the example above, we had highlighted cells A1-E4 before entering the Munit function, the 'additional' cells, E1-E4 are not part of the resulting matrix. Therefore, these cells will display the #N/A error. Be aware also that if, when you enter the Munit function, you don't highlight the entire range of cells that is needed to display the resulting matrix, Excel will just show the part of the result that fits into the highlighted range. There will be no error message to let you know that your highlighted range is not big enough.This will also be the case if you fail to enter the formula as an array formula - the cell which you enter the formula into will just show you the first entry of the resulting matrix.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8393176,"math_prob":0.8978917,"size":2106,"snap":"2019-51-2020-05","text_gpt3_token_len":459,"char_repetition_ratio":0.15889628,"word_repetition_ratio":0.0053475937,"special_character_ratio":0.21557455,"punctuation_ratio":0.09832134,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9780295,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-01-28T15:58:34Z\",\"WARC-Record-ID\":\"<urn:uuid:9bde28a6-c380-44a8-98d7-1d954e257de4>\",\"Content-Length\":\"13611\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6b41b9c2-93a2-452a-8228-9c4f0ae14742>\",\"WARC-Concurrent-To\":\"<urn:uuid:4dd84230-9273-411f-bb41-27d4799ce506>\",\"WARC-IP-Address\":\"173.247.245.106\",\"WARC-Target-URI\":\"https://www.excelfunctions.net/excel-munit-function.html\",\"WARC-Payload-Digest\":\"sha1:KEMWBK6M3XPTFXNGMKD4FBRYYKHMVMJG\",\"WARC-Block-Digest\":\"sha1:CVNXQFTFYIMEXJGDF75BCP3LNPZ3GUKL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-05/CC-MAIN-2020-05_segments_1579251779833.86_warc_CC-MAIN-20200128153713-20200128183713-00074.warc.gz\"}"}