Quick Answer

DETECTLANGUAGE Function

DETECTLANGUAGE tells you what language a piece of text is written in.

✓ Excel✓ Google SheetsExcel Google Sheets only

Syntax

DETECTLANGUAGE
(text)

Parameters

ParameterDescriptionRequired
textThe text whose language should be detected. Can be a string literal or a cell reference.Required

Basic Example

Detect the language of a sentence

=DETECTLANGUAGE('Hola, mundo')
Resultes

The text 'Hola, mundo' is detected as Spanish, returning the code 'es'.

Advanced Examples

Example 1: Detect language for a column

Customer support tickets

Find the language of each support ticket in a list

=ARRAYFORMULA(DETECTLANGUAGE(A2:A100))
Result: Language codes for each row
ARRAYFORMULA applies DETECTLANGUAGE to each cell in the range.

How DETECTLANGUAGE Works

DETECTLANGUAGE analyzes the provided text and returns the most likely ISO 639-1 language code. It uses the same language detection service as Google Translate.

1
Select the text
Choose the cell or string to analyze.
2
Enter the formula
Type =DETECTLANGUAGE(text).
3
Read the result
The result is a two-letter code like 'en', 'es', or 'zh'.

Important Notes & Limitations

  • DETECTLANGUAGE is Google Sheets only and has no native Excel equivalent.

  • Short texts or mixed languages may be detected incorrectly.

  • It returns only the language code, not the language name or confidence score.

Common Errors & Fixes

#VALUE! errorThe input is empty or not valid text.

Fix: Ensure the cell contains text and is not blank.

Wrong language codeThe text is too short or mixed with another language.

Fix: Provide more text for better detection accuracy.

Download Practice File

Practice DETECTLANGUAGE with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the DETECTLANGUAGE function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

Can it detect multiple languages in one cell?
No, it returns a single language code for the entire text.
What code does it return for Chinese?
It returns 'zh' for Chinese. Simplified and Traditional are not distinguished.
Does it work offline?
No, it requires an internet connection to use Google's language detection service.