How to use the TRANSLATE and DETECTLANGUAGE functions in Excel

Configurare noua (How To)

Situatie

Solutie

Before i show you some examples of each function in action, here are their syntaxes.

The TRANSLATE function has three arguments:

=TRANSLATE(a,b,c)

where

  • a (required) is either the text to translate (embedded in double quotes), or a reference to the cell containing the text to translate.
  • (optional) is the source language code in double quotes (see the Language Codes section below). If you omit this argument, Excel will try to detect the language automatically. Although this is an optional argument, it’s best to include it (if you know the language and its code) to ensure an accurate translation.
  • c (optional) is the target language in double quotes. If you skip this argument, Excel will use your system language as the target language. However, again, try to add a target language code for better translation outcomes.

This function is much more straightforward, requiring only one argument:

=DETECTLANGUAGE(x)

where

  • x is either the text to detect, embedded within double quotes, or a reference to the cell containing the text to detect.

Language Codes

Here are some of the language codes from Microsoft’s longer list of codes. Remember that all language codes in your formula must be in double quotes.

Code Language
“en” English
“es” Spanish
“fr” French
“de” German
“zh-chs” Mandarin (simplified)
“ru” Russian
“ar” Arabic

Example 1: Translating Text in Cells

Let’s say you have a vehicle expenses form, and you want to translate the form’s title, totals section, and table headers from English into Spanish.

A vehicle expenses form in Excel, with spaces left for translations of each field name into Spanish.

Starting in cell C2, type:

=TRANSLATE(A1,"en","es")

and press Enter.

Vehicle Expenses Form translated into Spanish in Excel using the TRANSLATE function.
Now, use the format painter tool to apply the formatting of the English title to the Spanish title. You can also apply a red font to distinguish between the two languages.
Vehicle Expenses Form translated into Spanish in Excel using the TRANSLATE function, and the formatting amended to distinguish the two languages.
You’re now ready to translate the next section of the form. First, select cell C1, and select and copy (Ctrl+C) the formula in the formula bar.
Cell C1 in Excel, which contains the TRANSLATE function, is activated, and the formula in the formula bar is selected and copied.
Now, select cell B3, paste (Ctrl+V) the copied formula into the formula bar, and change the first argument to reference cell A3, before pressing Enter.
The first argument in the TRANSLATE function in Excel is changed from A1 to A3.
Now, use the fill handle to apply the same relative formula to cells B4 to B6
An arrow indicating the direction in which Excel's fill handle should be clicked and dragged from cell B3 to apply the TRANSLATE function to other cells.
To finish this section, copy and paste the formula into cell E3, and use the fill handle again.
An Excel sheet containing information field titles that are translated from English to Spanish using the TRANSLATE function.
Because some of the Spanish translations contain more characters than their English counterparts, adjust the font sizes (or, if you prefer, the column widths) so that they fit nicely into their respective cells. Remember to also change the font colors to red for consistency.
An Excel sheet containing information field titles translated from English to Spanish using the TRANSLATE function and formatted in a red font.
Finally, follow the same process to translate your table headers.
A vehicle expenses form in Excel containing field names in English and Spanish, achieved by using the TRANSLATE function.

Tip solutie

Permanent

Voteaza

(4 din 6 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?