Back to functions
Text2026-11-111 related article

DETECTLANGUAGE Function in Excel

Identify the language of text and return its language code using Microsoft Translation Services.

Syntax

DETECTLANGUAGE(text)
Table of Contents

Arguments

text

Required

The text or reference to a cell containing the text to identify.

What it returns

Returns the detected language code as text from Microsoft Translation Services.

What DETECTLANGUAGE does

DETECTLANGUAGE returns a language code for a text value using Microsoft Translation Services. Put it beside imported descriptions when you want to review the source languages before or alongside translation.

The result is a code such as es, not a translated version of the sentence. Use TRANSLATE for the translation and Microsoft's language table to interpret the codes.

Practical examples

Identify a Spanish product description

Put Caja de cartón reciclado. in A5, then enter this formula in B5:

=DETECTLANGUAGE(A5)
Formula

The result was es, the code for Spanish, in Excel for Mac 16.114 (build 16.114.26101123) on November 11, 2026. This phrase means recycled cardboard box. Keep it beside the returned code so you can review the detection in context.

Check a French description on the next row

Put Sac en coton biologique. in A6, then enter this formula in B6:

=DETECTLANGUAGE(A6)
Formula

The same test returned fr, the code for French. The phrase means organic cotton bag. You can also fill the first formula from B5 down to B6; each row then checks its own source cell in column A.

These are clear-language examples. The codes are service results, so retain the source text and review unexpected output rather than assuming every detection is correct.

Common mistakes and notes

Short text may not identify a language reliably

A label such as Solo gives the service little context and can make sense in more than one language. Confirm the source when possible. A returned code isn't a confidence score or a guarantee of the intended language.

The function takes only a text argument

DETECTLANGUAGE has no source or target language argument. If you know the language and want a translation, pass that code directly to TRANSLATE instead.

A service error is different from an unexpected code

Microsoft's DETECTLANGUAGE reference expects text and documents problems with overlong text, non-text input, and request throttling. A number doesn't necessarily cause an error: =DETECTLANGUAGE(123) returned en in the same test. Digits alone don't establish an English source language, so don't treat a returned code as proof that the input was suitable.

Check a single clear text sample and the service connection before filling a large list. The function page doesn't specify a fixed quota or maximum character count.

Record reviewed results when they matter later

Keep the original descriptions and a dated copy of reviewed codes if another person needs a stable language audit. Service responses may change on a later calculation.

Related functions

Related articles

Deep dives, troubleshooting guides, and practical examples that use DETECTLANGUAGE.

Official documentation