DETECTLANGUAGE Function

Excel 2013+, Excel for Microsoft 365

Summary

The Excel DETECTLANGUAGE function automatically identifies the language of text using Microsoft Translator services. Returns a standard language code (ISO 639-1) for the detected language, making it perfect for multilingual data analysis and content processing.

Syntax

DETECTLANGUAGE(text)

Parameters

Parameter Type Required Description
text Text Yes Text string or cell reference to evaluate. Accepts single cells or ranges containing text.

Using the DETECTLANGUAGE Function

DETECTLANGUAGE leverages cloud-based AI to analyze text content and return the most likely language code. Ideal for cleaning multilingual datasets, validating user input, or automating language-specific processing in international workbooks.

Common DETECTLANGUAGE Examples

Detect Spanish Text

=DETECTLANGUAGE(A1)

If A1 contains 'Hola mundo!', returns 'es' (Spanish).

Language Detection from Range

=DETECTLANGUAGE(B2)

Analyzes text in B2 and returns the detected language code like 'fr' for French or 'de' for German.

Combine with Data Validation

=IF(DETECTLANGUAGE(C1)="en",UPPER(C1),C1)

Converts English text to uppercase while preserving other languages.

Frequently Asked Questions

Returns standard ISO 639-1 two-letter codes (es, fr, de, en, etc.). Full list available in Microsoft Translator documentation.

Yes, works effectively with phrases, sentences, or even single words. Accuracy improves with longer text.

Returns the dominant language. Very short mixed text may have lower accuracy.

Common Errors and Solutions

#VALUE! - Text too long

Cause: Input exceeds maximum character limit (typically 5000 characters)

Solution: Shorten text or split into smaller cells

#VALUE! - Invalid input

Cause: Cell contains numbers, dates, or non-text values

Solution: Ensure input contains only text strings

#SERVICE! or Request throttled

Cause: Exceeded daily translation service quota

Solution: Wait 24 hours or upgrade Microsoft 365 subscription

Notes

  • Service-backed function - requires internet connection
  • Results may vary as Microsoft updates language models
  • Supported languages listed at: https://learn.microsoft.com/azure/ai-services/Translator/language-support
  • Best accuracy with 3+ words of continuous text

Compatibility

Available in: Excel 2013, Excel 2016, Excel 2019, Excel 2021, Excel for Microsoft 365

Not available in: Excel 2010 and earlier, Excel Online (limited)

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2013+, Excel for Microsoft 365