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

ArgumentRequired?What it does
textYesThe text whose language you want to identify.

Examples

Example 1 — Routing customer feedback

Northstar receives feedback in several languages.

AB
1FeedbackLanguage
2Great service, thank you!en
3Merci pour la livraison rapidefr
4El pedido llegó tardees
B2: =DETECTLANGUAGE(A2), filled down — results from Excel for Microsoft 365
=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.
Kyle Stott

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.