Practice free

DETECTLANGUAGE function

DETECTLANGUAGE guesses which language a piece of text is written in and returns a language code such as en or fr. It needs an internet connection and is unreliable on short strings.

Example

Practice this in the app

Syntax

DETECTLANGUAGE(text)

text (required)
The text whose language you want identified.

Returns: A language code such as "en" or "fr".

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=DETECTLANGUAGE("") Empty text
=DETECTLANGUAGE("Bonjour tout le monde") #UNKNOWN_CODE_2051 French text
=ERROR.TYPE(DETECTLANGUAGE("Bonjour tout le monde")) #UNKNOWN_CODE_2051 Which error code
=ISERROR(DETECTLANGUAGE("Bonjour tout le monde")) #UNKNOWN_CODE_2051 Is it an error

Watch out for

  • Needs an internet connection and a Microsoft 365 subscription.
  • Short strings give unreliable guesses.

Where it works

Excel
DETECTLANGUAGE is only in Excel for Microsoft 365 and Excel for the web. Microsoft 365 only; sends text to an online service.
Google Sheets
Same name, same behaviour for everyday use. Sheets has DETECTLANGUAGE with the same purpose.

Part of Text functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .