# DETECTLANGUAGE in Google Sheets: syntax and examples

URL: https://goingstellar.ro/reference/sheets/detectlanguage/

DETECTLANGUAGE returns the language code (en, ro, de) it finds in the text. Pair it with GOOGLETRANSLATE to translate only the cells that are not already in your target language.

## Syntax

```
DETECTLANGUAGE(text_or_range)
```

## Arguments

- `text_or_range` (any, required: yes): The text, or a cell reference, whose language to identify.

## Examples

The examples use this table, starting in A1:

| Text |
|---|
| Bună ziua, ce mai faci azi? |
| Hello, how are you today? |
| Guten Morgen, wie geht es dir? |

```
=DETECTLANGUAGE(A2)
```

Result: `ro`

Romanian text returns the code ro. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=DETECTLANGUAGE(A3)
```

Result: `en`

English text returns en. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=DETECTLANGUAGE("Guten Morgen wie geht es dir")
```

Result: `de`

A string can be typed straight into the formula. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=UPPER(DETECTLANGUAGE(A4))
```

Result: `DE`

The result is plain text, so other text functions work on it. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=IF(DETECTLANGUAGE(A3)="en","keep","translate")
```

Result: `keep`

Branch on the detected code. Run in a Google Sheet (English US locale) on 2026-11-29.

## Common errors

- A range of several cells returns #VALUE!, even inside ARRAYFORMULA, despite the argument name text_or_range. Write one formula per cell and fill it down.
- A number such as 12345 has no language: the result is und (undetermined), not an error.

## Compared with Excel

Excel has no DETECTLANGUAGE function.

## Related functions

- [GOOGLETRANSLATE](https://goingstellar.ro/reference/sheets/googletranslate/)
- [UPPER](https://goingstellar.ro/reference/sheets/upper/)
- [LOWER](https://goingstellar.ro/reference/sheets/lower/)
- [IF](https://goingstellar.ro/reference/sheets/if/)
- [ARRAYFORMULA](https://goingstellar.ro/reference/sheets/arrayformula/)
- [IFERROR](https://goingstellar.ro/reference/sheets/iferror/)

## Sources

- [DETECTLANGUAGE (Docs Editors Help)](https://support.google.com/docs/answer/3093278)

