DETECTLANGUAGE Function
Identifies the language of a piece of text.
Category
Text
Available in
Microsoft 365
Returns
A language code
Overview
DETECTLANGUAGE reads some text and returns a short language code: "en" for English, "fr" for French, "es" for Spanish.
It uses Microsoft's online translation service, so it needs Microsoft 365 and an internet connection.
Syntax
=DETECTLANGUAGE(text) Explain
Arguments
| Argument | Required? | What it does |
|---|---|---|
| text | Yes | The text whose language you want to identify. |
Examples
Example 1 — Routing customer feedback
Northstar receives feedback in several languages.
| A | B | |
|---|---|---|
| 1 | Feedback | Language |
| 2 | Great service, thank you! | en |
| 3 | Merci pour la livraison rapide | fr |
| 4 | El pedido llegó tarde | es |
=DETECTLANGUAGE(A2) Explain
Feed the result into TRANSLATE: =TRANSLATE(A2, DETECTLANGUAGE(A2), "en").
Common mistakes
- Very short text. A single word can belong to several languages; give it a full sentence where you can.
Notes
- Not available in Excel 2024 or earlier perpetual versions, or offline.
- Related functions: TRANSLATE.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.