Funci贸ns de texto

This section contains descriptions of the Text functions.

Para acceder a esta orde...

Inserir - Funci贸n, categor铆a Texto


Using double quotation marks in formulas

To include a text string in a formula, place the text string between two double quotation marks (") and Calc takes the characters in the string without attempting to interpret them. For example, the formula ="Hello world!" displays the text string Hello world! in the cell, with no surrounding double quotation marks.

The more complex formula =CONCATENATE("Life is really simple, "; "but we insist on making it complicated "; "(Confucius).") concatenates three individual strings in double quotation marks, outputting Life is really simple, but we insist on making it complicated (Confucius).

To place a literal double quotation mark within a string inside a formula, two methods can be used:

  1. You can "escape" the double quotation mark with an additional double quotation mark, and Calc treats the escaped double quotation mark as a literal value. For example, the formula ="My name is ""John Doe""." outputs the string My name is "John Doe". Another simple example is the formula =UNICODE("""") which returns 34, the decimal value of the Unicode quotation mark character (U+0022) 鈥 here the first and fourth double quotation marks indicate the beginning and end of the string, while the second double quotation mark escapes the third.

  2. You can use the CHAR function or the UNICHAR function to insert a double quotation mark. For example, the formula =UNICHAR(34) & "The Catcher in the Rye" & UNICHAR(34) & " is a famous book by J. D. Salinger." displays the string "The Catcher in the Rye" is a famous book by J. D. Salinger.

Be aware that Calc's AutoCorrect function may modify double quotation marks. AutoCorrect should not change the double quotation marks within formula cells but may change those used in non-formula cells containing text. For example, if you copy a string that is surrounded by some other form of typographical double quotation marks, such as the left double quotation mark (U+201C) and the right double quotation mark (U+201D), and then paste into a formula cell, an error may result. Open the Double Quotes area of the Tools - AutoCorrect Options - Localized Options dialog to set the characters used to automatically correct the start and end typographical double quotation marks. Uncheck the Replace toggle button to disable the feature.

ARABIC

Returns the numeric value corresponding to a Roman number expressed as text.

ASC

Converts double-byte (full-width) characters to single-byte (half-width) ASCII and katakana characters.

JIS

Converts single-byte (half-width) ASCII or katakana characters to double-byte (full-width) characters.

REGEX

Matches and extracts or optionally replaces text using regular expressions.

ROMAN

Converts a number into a Roman numeral. The value range must be between 0 and 3999. A simplification mode can be specified in the range from 0 to 4.

VALUE

Converts the string representation of a number to numeric form. If the supplied string is a valid date, time, or date-time, the corresponding date-time serial number is returned.

WEBSERVICE

Get some web content from a URI.

FILTERXML

Apply a XPath expression to a XML document.

ENCODEURL

Returns a URL-encoded string.

BASE

Converts a positive integer to a specified base into a text from the numbering system. The digits 0-9 and the letters A-Z are used.

Sintaxe

BASE(N煤mero; Base [;LonxitudeM铆nima])

N 茅 o n煤mero enteiro positivo a ser convertido.

Radix indicates the base of the numeral system. It may be any positive integer between 2 and 36.

MinimumLength (opcional) determina a lonxitude m铆nima da secuencia de caracteres que se creou. Se o texto 茅 m谩is curto que o longo m铆nimo indicado, os ceros son engadidos 谩 esquerda da cadea.

Exemplo

= BASE (17; 10; 4) d谩 0017 no sistema decimal.

= BASE (17, 2) d谩 10001 no sistema binario.

= BASE (255; 16; 4) d谩 00FF no sistema hexadecimal.

See also

DECIMAL

CAMBIARTEXTO

Substit煤e un texto novo por un texto antigo nunha cadea de caracteres.

Sintaxe

SUBSTITUTE("Text"; "SearchText"; "NewText" [; Occurrence])

Texto 茅 o texto en que segmentos de texto deben ser trocados.

searchText 茅 o segmento de texto que debe ser substitu铆do (varias veces).

newText 茅 o texto que debe substitu铆r o segmento de texto.

Aparici贸n (opcional) indica que a aparici贸n do texto de busca 茅 que ser substitu铆do. Se ese par谩metro falta o texto de busca 茅 substitu铆do por todas partes.

Exemplo

= Suplente (\ "123123123";"3";"abc") d谩 12abc12abc12abc.

= Suplente (\ "123123123";"3";"abc"; 2) d谩 12312abc123.

CARACT

Converte un n煤mero nun car谩cter de acordo coa t谩boa de c贸digo actual. O n煤mero pode ser un n煤mero enteiro de dous d铆xitos ou tres d铆xitos.

Os c贸digos maiores de 127 poden depender do mapa de caracteres do sistema (por exemplo, iso-8859-1, iso-8859-2, Windows-1252, Windows-1250) e, por este motivo, poden non ser port谩beis.

Sintaxe

CARACT(N煤mero)

N煤mero 茅 un n煤mero entre 1 e 255 que representa o valor de c贸digo do car谩cter.

Exemplo

= CHAR (100) devolve o car谩cter d.

="abc" & CHAR(10) & "def" inserts a newline character into the string.

CONCATENAR

Combina varios secuencias de texto nunha cadea.

Sintaxe

CONCATENAR(String 1 [; String 2 [; 鈥 [; String 255]]])

String 1[; String 2][; 鈥 ;[String 255]] are strings or references to cells containing strings.

Exemplo

=CONCATENATE("Good ";"Morning ";"Mrs. ";"Doe") returns: Good Morning Mrs. Doe.

C脫DIGO

Devolve un c贸digo num茅rico correspondente ao primeiro car谩cter dunha cadea de caracteres de texto.

Sintaxe

C脫DIGO("texto")

Texto 茅 o texto para o cal se debe atopar o c贸digo do primeiro car谩cter.

Os c贸digos maiores de 127 poden depender do mapa de caracteres do sistema (por exemplo, iso-8859-1, iso-8859-2, Windows-1252, Windows-1250) e, por este motivo, poden non ser port谩beis.

Exemplo

= C脫DIGO (\ "Hieronymus") d谩 72, = C脫DIGO (\ "\ xerogl铆fica") retorno 104.

note

O c贸digo utilizado aqu铆 non se refire a ASCII, mais a t谩boa de c贸digo cargado no momento.


DECIMAL

Converts text that represents a number in a numeral system with the given base radix to a positive integer. The radix must be in the range 2 to 36. Spaces and tabs are ignored. The Text field is not case-sensitive.

If the radix is 16, a leading x or X or 0x or 0X, and an appended h or H, are disregarded. If the radix is 2, an appended b or B is disregarded. Other characters that do not belong to the numeral system generate an error.

Sintaxe

Decimal (\ "Texto"; Radix)

Text is the text to be converted.

Radix indicates the base of the numeral system. It may be any positive integer between 2 and 36.

Exemplo

=DECIMAL("17";10) d谩 17.

= decimal (\ "CARA"; 16) d谩 64.206.

=DECIMAL("0101";2) d谩 5.

See also

BASE

DEREITA

Devolve o derradeiro car谩cter ou caracteres dun texto.

Sintaxe

DEREITA("Texto"; [;N煤mero])

Texto 茅 o texto do cal a parte dereita 茅 para ser determinado.

Number (optional) is the number of characters from the right part of the text. If this parameter is not defined, one character is returned.

Exemplo

=DEREITA("Sun";2) devolve un.

DEREITAB

Devolve o 煤ltimo car谩cter ou caracteres dun texto co dobre personaxes bytes conxuntos (DBCS).

tip

Esta funci贸n est谩 dispo帽铆bel desde a versi贸n 4.2 do LibreOffice.


Sintaxe

DEREITAB ("Texto" [; N煤mero_bytes])

Texto 茅 o texto do cal a parte dereita 茅 para ser determinado.

Number_bytes (optional) specifies the number of characters you want RIGHTB to extract, based on bytes. If this parameter is not defined, one byte is returned.

Exemplo

RIGHTB("涓浗";1) returns " " (1 byte is only half a DBCS character and a space character is returned instead).

RIGHTB("涓浗";2) returns "鍥" (2 bytes constitute one complete DBCS character).

RIGHTB("涓浗";3) returns " 鍥" (3 bytes constitute one half DBCS character and one whole DBCS character; a space is returned for the first half).

RIGHTB("涓浗";4) returns "涓浗" (4 bytes constitute two complete DBCS characters).

LenB (\ "oficina") Devolve 6 (seis caracteres non DBCS cada unha composta por un byte).

ESQUERDA

Devolve o primeiro car谩cter ou primeiros caracteres dun texto.

Sintaxe

ESQUERDA("Texto" [; N煤mero])

Texto 茅 o texto en que as palabras parciais iniciais deben ser determinadas.

N煤mero (opcional) indica o n煤mero de caracteres para o texto inicial. Se este par谩metro non 茅 definido, un car谩cter 茅 de retorno.

Exemplo

= LEFT (\ "sa铆da"; 3) retorno "out".

ESQUERDAB

Devolve os primeiros caracteres dun texto DBCS.

tip

Esta funci贸n est谩 dispo帽铆bel desde a versi贸n 4.2 do LibreOffice.


Sintaxe

ESQUERDAB("Texto" [;N煤mero_bytes])

Texto 茅 o texto en que as palabras parciais iniciais deben ser determinadas.

Number_bytes (opcional) indica o n煤mero de caracteres que quere LeftB para extraer, con base en bytes. Se este par谩metro non 茅 definido, un car谩cter 茅 de retorno.

Exemplo

=LEFTB("涓浗";1) returns " " (1 byte is only half a DBCS character and a space character is returned instead).

=LEFTB("涓浗";2) returns "涓" (2 bytes constitute one complete DBCS character).

=LEFTB("涓浗";3) returns "涓 " (3 bytes constitute one DBCS character and a half; the last character returned is therefore a space character).

=LEFTB("涓浗";4) returns "涓浗" (4 bytes constitute two complete DBCS characters).

=LEFTB("office";3) returns "off" (3 non-DBCS characters each consisting of 1 byte).

EXACTO

Compara d煤as secuencias de texto e devolve VERDADEIRO se son id茅nticos. Esta funci贸n distingue entre mai煤sculas e min煤sculas.

Sintaxe

EXACT("Text1"; "Text2")

Text1 ref铆rese ao primeiro texto para comparar.

text2 茅 o segundo texto para comparar.

Exemplo

= exacto (\ "microssistemas";"Microsystems") d谩 FALSE.

FIXO

Returns a number as text with a specified number of decimal places and optional thousands separators.

Sintaxe

FIXED(Number; [Decimals = 2 [; NoThousandsSeparators = FALSE]])

Number is rounded to Decimals places (after the decimal separator) and the result formatted as text, using locale-specific settings.

Decimals (optional) refers to the number of decimal places to be displayed. If Decimals is negative, Number is rounded to ABS(Decimals) places to the left from the decimal point. If Decimals is a fraction, it is truncated actually ignoring what is the closest integer.

NoThousandsSeparators (optional) determines whether the thousands separator is used. If it is TRUE or non-zero, then group separators are omitted from the resulting string. If the parameter is equal to 0 or if it is missing altogether, the thousands separators of your current locale setting are displayed.

Exemplo

= FIXO (1.234.567,89; 3) d谩 1,234,567.890 como unha cadea de texto.

=FIXED(123456.789;;TRUE) returns 123456.79 as a text string.

=FIXED(12345.6789;-2) returns 12,300 as a text string.

=FIXED(12134567.89;-3;1) returns 12135000 as a text string.

=FIXED(12345.789;3/4) returns 12,346 as a text string.

=FIXED(12345.789;8/5) returns 12,345.8 as a text string.

LIMPAR

Todos os caracteres non imprimibles elim铆nanse da cadea.

Sintaxe

CLEAN("texto")

Texto ref铆rese ao texto de partida para eliminar todos os caracteres non imprimibles.

Exemplo

=LEN(CLEAN(CHAR(7) & "LibreOffice Calc" & CHAR(8))) returns 16, showing that the CLEAN function removes the non-printable Unicode U+0007 ("BEL") and U+0008 ("BS") characters at the beginning and end of the string argument. CLEAN does not remove spaces.

LOCALIZAR

Returns the position of a string of text within another string.You can also define where to begin the search. The search term can be a number or any string of characters. The search is case-sensitive.

Sintaxe

FIND("FindText"; "Text" [; Position])

FindText ref铆rese ao texto a atopar.

Texto 茅 o texto en que a investigaci贸n ocorre.

Posici贸n (opcional) 茅 a posici贸n no texto a partir do cal a investigaci贸n comeza.

Exemplo

= find (76; 998.877.665.544) 6 retorno.

LONX

Devolve a lonxitude dunha cadea, inclu铆ndo espazos.

Sintaxe

LONX (芦Texto禄)

text 茅 o texto cuxa lonxitude 茅 para ser determinada.

Exemplo

= LEN (\ "Boa Tarde") d谩 14.

=LEN(12345.67) d谩 8.

LONX.B

Para a conxunto de caracteres de bytes dobres (DBCS) idiomas, devolve o n煤mero de bytes usados 鈥嬧媝ara representar os car谩cteres nunha secuencia de texto.

tip

Esta funci贸n est谩 dispo帽铆bel desde a versi贸n 4.2 do LibreOffice.


Sintaxe

LenB (\ "Texto")

text 茅 o texto cuxa lonxitude 茅 para ser determinada.

Exemplo

LenB (\ "涓") d谩 2 (1 car谩cter DBCS que consiste en 2 bytes).

LenB (\ "涓浗") d谩 4 (2 DBCS caracteres cada composto por 2 bytes).

LenB (\ "oficina") Devolve 6 (seis caracteres non DBCS cada unha composta por un byte).

= LenB (\ "Boa Tarde") d谩 14.

= LenB (12.345,67) d谩 8.

MAI脷SCULA

Converte a secuencia de caracteres especificada no texto campo a mai煤scula.

Sintaxe

UPPER("Text")

Texto ref铆rese 谩s letras min煤sculas que quere converter a mai煤sculas.

Exemplo

= UPPER (\ "Good Morning") d谩 BO D脥A.

MEDIO

Devolve unha cadea de texto dun texto. Os par谩metros especifican a posici贸n inicial e o n煤mero de caracteres.

Sintaxe

MID (\ "Texto"; Iniciar; Number)

Texto 茅 o texto que cont茅n os caracteres para extraer.

Iniciar 茅 a posici贸n do primeiro car谩cter no texto para extraer.

N煤mero especifica o n煤mero de caracteres na parte do texto.

Exemplo

= MID (\ "oficina"; 2; 2) d谩 ff.

MEDIOB

Devolve unha cadea de texto dun texto DBCS. Os par谩metros especifican a posici贸n inicial e o n煤mero de caracteres.

tip

Esta funci贸n est谩 dispo帽铆bel desde a versi贸n 4.2 do LibreOffice.


Sintaxe

MIDB (\ "Texto"; Iniciar; Number_bytes)

Texto 茅 o texto que cont茅n os caracteres para extraer.

Iniciar 茅 a posici贸n do primeiro car谩cter no texto para extraer.

Number_bytes especifica o n煤mero de caracteres MIDB volver谩 do texto, en bytes.

Exemplo

=MIDB("涓浗";1;0) returns "" (0 bytes is always an empty string).

=MIDB("涓浗";1;1) returns " " (1 byte is only half a DBCS character and therefore the result is a space character).

=MIDB("涓浗";1;2) returns "涓" (2 bytes constitute one complete DBCS character).

=MIDB("涓浗";1;3) returns "涓 " (3 bytes constitute one and a half DBCS character; the last byte results in a space character).

=MIDB("涓浗";1;4) returns "涓浗" (4 bytes constitute two complete DBCS characters).

=MIDB("涓浗";2;1) returns " " (byte position 2 is not at the beginning of a character in a DBCS string; 1 space character is returned).

=MIDB("涓浗";2;2) returns " " (byte position 2 points to the last half of the first character in the DBCS string; the 2 bytes asked for therefore constitutes the last half of the first character and the first half of the second character in the string; 2 space characters are therefore returned).

=MIDB("涓浗";2;3) returns " 鍥" (byte position 2 is not at the beginning of a character in a DBCS string; a space character is returned for byte position 2).

=MIDB("涓浗";3;1) returns " " (byte position 3 is at the beginning of a character in a DBCS string, but 1 byte is only half a DBCS character and a space character is therefore returned instead).

=MIDB("涓浗";3;2) returns "鍥" (byte position 3 is at the beginning of a character in a DBCS string, and 2 bytes constitute one DBCS character).

=MIDB("office";2;3) returns "ffi" (byte position 2 is at the beginning of a character in a non-DBCS string, and 3 bytes of a non-DBCS string constitute 3 characters).

MIN脷SCULA

Converte todas as letras mai煤sculas nunha secuencia de texto en min煤sculas.

Sintaxe

MIN脷SCULA(texto)

Texto ref铆rese ao texto a ser convertido.

Exemplo

=MIN脷SCULA("Sol") devolve sol.

MOEDA

Converts a number to a string representing the amount in the currency format, rounded to a specified decimal places, using the decimal separator that corresponds to the current locale setting. In the Value field enter the number to be converted. Optionally, you may enter the number of decimal places in the Decimals field. If no value is specified, all numbers in currency format will be displayed with two decimal places.

Define o formato de moeda en s煤as opci贸ns de sistema.

Sintaxe

DOLLAR(Value [; Decimals])

Valor 茅 un n煤mero, unha referencia a unha cela que cont茅n un n煤mero, ou unha f贸rmula que d谩 un n煤mero.

Decimals 茅 o n煤mero opcional de cifras decimais.

Exemplo

=DOLLAR(255) returns $255.00 for the English (USA) locale and USD (dollar) currency; 锟255.00 for the Japanese locale and JPY (yen) currency; or 255,00 鈧 for the German (Germany) locale and EUR (euro) currency.

=DOLLAR(367.456;2) returns $367.46.

PRIMMAI脷SCULA

mai煤scula a primeira letra de todas as palabras dunha cadea de texto.

Sintaxe

PRIMMAI脷SCULA(芦Texto禄)

Texto ref铆rese ao texto a ser convertido.

Exemplo

=PROPER("the document foundation") returns The Document Foundation.

PROCURAR

Returns the position of a text segment within a character string. You can set the start of the search as an option. The search text can be a number or any sequence of characters. The search is not case-sensitive. If the text is not found, returns error 519 (#VALUE).

The search supports wildcards or regular expressions. With regular expressions enabled, you can enter "all.*", for example to find the first location of "all" followed by any characters. If you want to search for a text that is also a regular expression, you must either precede every regular expression metacharacter or operator with a "\" character, or enclose the text into \Q...\E. You can switch the automatic evaluation of wildcards or regular expression on and off in - LibreOffice Calc - Calculate.

warning

Ao empregar funci贸ns nas que un ou m谩is argumentos sexan criterios de busca que representen unha expresi贸n regular, t茅ntase primeiro converter os criterios da cadea en n煤meros. Por exemplo, 芦.0禄 conv茅rtese en 0.0, etc. Se resulta ben, a busca non ser谩 unha coincidencia de expresi贸n regular sen贸n unha coincidencia num茅rica. Por茅n, ao traballar cunha configuraci贸n rexional na que o separador decimal non sexa o punto, como en galego, o punto fai que funcione a conversi贸n a expresi贸n regular. Para obrigar a que a avaliaci贸n sexa dunha expresi贸n regular no canto dunha expresi贸n num茅rica hai que empregar algunha expresi贸n que non se poda confundir cunha num茅rica, como 芦.[0]禄, 芦.\0禄 ou 芦(?i).0禄.


Sintaxe

SEARCH("FindText"; "Text" [; Position])

FindText 茅 o texto a ser buscado.

Texto 茅 o texto en que a investigaci贸n ser谩 realizada.

Posici贸n (opcional) 茅 a posici贸n no texto onde a procura para comezar.

Exemplo

= SEARCH (54; 998.877.665.544) d谩 10.

RECORTAR

Elimina os espazos dunha corda, deixando s贸 un 煤nico car谩cter de espazo entre as palabras.

Sintaxe

TRIM("Text")

Texto ref铆rese ao texto en que os espazos deben ser eliminadas.

Exemplo

=TRIM(" hello world ") returns hello world without leading and trailing spaces and with single space between words.

REPETIR

Repite unha secuencia de caracteres por n煤mero dato de copias.

Sintaxe

REPT (\ "Texto"; Number)

Texto 茅 o texto a repetirse.

N煤mero 茅 o n煤mero de repetici贸ns.

Exemplo

=REPT("Bo d铆a";2)devolve Bos d铆asBos d铆as.

tip

Refer to the REPT wiki page for more details about this function.


SUBSTITU脥R

Substit煤e parte dunha cadea de texto cunha secuencia de texto diferente. Esta funci贸n pode usarse para substitu铆r caracteres e n煤meros (que automaticamente convertidas en texto). O resultado da funci贸n sempre aparece como texto. Se desexa realizar outros c谩lculos cun n煤mero que foi substitu铆do polo texto, ter谩 que convertelo-lo de volta para un n煤mero usando o VALOR funci贸n.

Calquera texto que conte帽a n煤meros deber谩 colocar entre comi帽as se non quere que sexa interpretado como un n煤mero e automaticamente convertidas en texto.

Sintaxe

REPLACE("Text"; Position; Length; "NewText")

Texto ref铆rese ao texto do cal unha parte ser谩 substitu铆da.

Posici贸n ref铆rese 谩 posici贸n no texto onde a substituci贸n comeza.

Lonxitude 茅 o n煤mero de caracteres en Texto para ser substitu铆do.

newText ref铆rese ao texto que substit煤e Texto .

Exemplo

=REPLACE("1234567";1;1;"444") returns "444234567". One character at position 1 is replaced by the complete NewText.

T

Esta funci贸n devolve o texto de destino, ou unha secuencia de texto en branco se o destino non 茅 o texto.

Sintaxe

T(valor)

Se Valor 茅 unha cadea de texto ou ref铆rese a unha cadea de texto, T devolve esta cadea de texto; en caso contrario, devolve unha secuencia de texto en branco.

Exemplo

= T (12345) devolve unha cadea baleira.

= T (\ "12345") d谩 a secuencia 12345.

TEXTO

Converts a value into text according to a given format.

Sintaxe

TEXT(Value; Format)

Value is the value (numerical or textual) to be converted.

Formatar 茅 o texto que define o formato. Use separadores decimais e miles de acordo co idioma definido no formato de cela.

Exemplo

= TEXT (12,34567;". ### ##") devolve o texto 12,35

= TEXT (12,34567;"000.00") devolve o texto 012,35

=TEXT("xyz";"=== @ ===") returns the text === xyz ===

tip

See also Number format codes: custom format codes defined by the user.


TEXTOBAHT

Converte un n煤mero en texto Tailand茅s, inclu铆ndo os nomes de moedas tailandesas.

Sintaxe

TEXTOBAHT(N煤mero)

Number is any number. "Baht" is appended to the integral part of the number, and "Satang" is appended to the decimal part of the number.

Exemplo

=BAHTTEXT(12.65) returns a string in Thai characters with the meaning of "Twelve Baht and sixty five Satang".

Technical information

This function is not part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

COM.MICROSOFT.BAHTTEXT

UNICHAR

Converte un n煤mero de c贸digo a un car谩cter ou letra Unicode.

Sintaxe

UNICHAR(number)

Exemplo

= UNICHAR (169) devolve o personaxe de Copyright .

tip

See also the UNICODE() function.


UNICODE

Devolve o c贸digo num茅rico do primeiro car谩cter Unicode dunha cadea de texto.

Sintaxe

UNICODE("Text")

Exemplo

= Unicode (\ "漏") devolve o n煤mero Unicode 169 para o personaxe de Copyright.

tip

See also the UNICHAR() function.


Precisamos da s煤a axuda!