Contact

DETECTLANGUAGE Function in Microsoft Excel: Syntax, Examples & Troubleshooting

Text Intermediate Microsoft Excel

Identify text language in Excel with DETECTLANGUAGE. Follow Microsoft’s Spanish example, handle text-only inputs, ambiguous phrases and service throttling without assuming offline results.

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

Quick answer: DETECTLANGUAGE(text) asks Microsoft Translation Services to identify the language of supplied text and returns a language code. It is service-backed, so supported languages, availability and results can change. It is not an offline character lookup.

Syntax and service scope

=DETECTLANGUAGE(text)

The text argument is required and may be a text value or a cell reference containing text. There are no documented source-language, confidence-threshold or offline-mode arguments. The current Microsoft page lists Microsoft 365, Microsoft 365 for Mac and Excel Mobile; that list does not promise every update channel or account has the service enabled.

Language codes and supported languages are documented in Microsoft’s Translator language list, checked October 17, 2026. Check that list rather than guessing a code from an English language name.

Worked example: the vendor’s Spanish illustration

  1. Put the public sample text Hola mundo! in A1.
  2. In B1 enter =DETECTLANGUAGE(A1) in a supported Excel environment with permitted service access.
  3. Microsoft’s documented example reports es, the code for Spanish.

This is a documentation-reported expected example, not a service response obtained while writing this guide. A future response, error or service limitation must be evaluated on its own; the source explicitly warns that results may vary.

The returned code is not a translation of the text. It also does not identify the writer’s nationality, location or preferred language. Treat it as the service’s classification of the submitted text only.

Second example: literal text and a selector cell

=DETECTLANGUAGE("Hola mundo!") supplies the same sample directly rather than through A1. Under the same service conditions, the documented Spanish classification es is the intended expectation. The quotation marks identify the text literal; typing an unquoted phrase is not equivalent.

For a small review sheet, keep source text in column A and detected codes in column B. If A2 is intentionally blank, a guard such as =IF(A2="","",DETECTLANGUAGE(A2)) returns empty text for that blank branch rather than labeling it as an unknown language. This is a worksheet-control example; no translation service call was made for the guide.

Advanced application: route text for human review

Suppose B1 contains the documented code es. =IF(B1="es","Spanish review","Check language") is independently expected to return Spanish review. That downstream rule is deterministic once the code exists; it does not make the language detector itself deterministic or validated for every input.

Short strings, names, product codes and mixed-language sentences may lack enough context for a dependable classification. Preserve the original text and let a reviewer correct an unsuitable label. Avoid treating a one-word classification as proof that a whole document is in one language.

Before applying the formula to a large column, test a small set of nonconfidential examples and check service availability and any organizational policy. A spreadsheet can contain private or regulated text; decide whether it is appropriate to submit that text to a service before using a service-backed formula. No account setup, service request or private-data transmission was performed here.

Troubleshooting

Microsoft describes these common error categories without assigning a complete numeric quota or character limit in the individual page:

  • Text Too Long: reduce the submitted text size; do not assume an invented fixed limit.
  • Error in Value: a nontext input was supplied; this function expects text.
  • Request Throttled: the daily translation-function quota has been exceeded. A large formula fill or repeated attempts is not a reliable remedy.

If Excel does not recognize the function, check the actual build and service availability before rewriting valid text. Do not bypass security settings or assume an unrelated translation API is an equivalent licensed backend. The examples document intended use and conditional outputs only.

Compatibility and verification

Microsoft’s reference checked on October 17, 2026 lists: Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel Mobile. Microsoft’s alphabetical catalog, checked October 17, 2026, identifies DETECTLANGUAGE with a Microsoft 365 introduction marker. That marker does not establish an exact rollout date, update channel or perpetual-license release. The last functioning version is unverified; no retirement is asserted.

Example verification: Expected numerical results are independently calculated; text and shape expectations follow the documented contract. These examples have not been tested in Microsoft Excel. No screenshot or native execution is claimed.