Funções de texto

Esta secção contém descrições das funções de texto.

Para aceder a este comando...

Inserir - Função - Categoria 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.

Empty string and blank cells

Cells with the empty string ("") are not equivalent to blank cells. When searching or calculating with text, the empty string "" is the text with length zero.

For example, when the formula in A1 returns the empty string "", the following applies:

=ISBLANK(A1) returns FALSE. The cell is not blank.

=ISFORMULA(A1) returns TRUE. The cell is a formula.

=ISLOGICAL(A1) returns FALSE. Not a logical value.

=ISNONTEXT(A1) returns FALSE. The cell has the empty string.

=ISNUMBER(A1) returns FALSE. Not a number.

=ISTEXT(A1) returns TRUE. The cell has the empty string, calculated by a formula.

=LEN(A1) returns 0. The length of the empty string is 0.

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.

BAHTTEXT

Converte um número em texto tailandês, incluindo os nomes da moeda tailandesa.

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.

CHAR

Converte um número num carácter de acordo com a tabela de código ativa. O número pode ser um inteiro com dois ou três dígitos.

CLEAN

Todos os caracteres não imprimíveis são eliminados da cadeia.

CODE

Devolve um código numérico correspondente ao primeiro carácter de uma cadeia.

CONCATENATE

Combina várias cadeias de texto numa única cadeia.

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.

DOLLAR

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.

EXACT

Compara duas cadeias de texto e devolve VERDADEIRO se forem idênticas. Esta função diferencia maiúsculas e minúsculas.

FIND

Devolve uma cadeia de texto dentro de uma outra cadeia. Pode também definir onde pretende iniciar a procura. O termo de procura pode ser um número ou qualquer cadeia de caracteres. A procura diferencia maiúsculas e minúsculas.

FIXED

Devolve um número como texto para um número especificado de casas decimais e separador de milhares opcionais.

JIS

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

LEFT

Devolve o primeiro carácter ou caracteres de um texto.

LEFTB

Devolve número especificado de caracteres no início de uma cadeia de texto, baseado no número de bytes especificados.

LEN

Devolve o comprimento de uma cadeia, incluindo os espaços.

LENB

Devolve o número de bytes utilizado para representar os carateres numa cadeia de texto.

LOWER

Converte todas as letras maiúsculas em minúsculas num determinado texto.

MID

Devolve uma cadeia de texto de um texto. Os parâmetros especificam a posição inicial e o número de caracteres.

MIDB

Devolve um número específico de carateres de uma cadeia de texto, começando na posição que especificar, com base no número de bytes especificado.

PROPER

Transforma as primeiras letras de todas as palavras numa cadeia em maiúsculas.

REGEX

Procura e extrai ou, opcionalmente, substitui texto usando de expressões regulares.

REPLACE

Substitui parte de uma cadeia por outra cadeia. Esta função pode ser utilizada para substituir caracteres e/ou números (automaticamente convertidos em texto). O resultado da função é sempre mostrado como texto. Se quiser executar mais cálculos com um número que foi substituído por texto, tem que converter o texto em número utilizando a função VALOR.

REPT

Copia uma cadeia de caracteres um determinado número de vezes.

RIGHT

Devolve o último carácter ou caracteres de um texto.

RIGHTB

Devolve o último caráter ou carateres numa cadeia de texto, baseado no número de bytes especificados.

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.

SEARCH

Devolve a posição de um segmento de texto dentro de uma cadeia de caracteres. É possível definir o início da procura, como opção. O texto de procura pode ser um número ou qualquer cadeia de caracteres. A procura não diferencia maiúsculas e minúsculas. Se o texto não for encontrado, devolve o erro 519 (#VALOR).

SUBSTITUTE

Substitui texto anterior com texto novo numa cadeia.

T

Esta função devolve um valor se for texto ou uma cadeia de texto vazia, se o não for.

TEXT

Converts a value into text according to a given format.

TRIM

Remove os espaços de uma cadeia, deixando apenas um carácter de espaço entre as palavras.

UNICHAR

Converte o número de um código num carácter ou letra Unicode.

UNICODE

Devolve o código numérico correspondente ao primeiro carácter Unicode numa cadeia de texto.

UPPER

Coloca a cadeia especificada no campo texto em maiúsculas.

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.

SERVIÇOWEB

Devolve os dados de um serviço web, através do seu URL.

FILTRARXML

Devolve os dados específicos do conteúdo XML utilizando um XPath.

CODIFICAÇÃOURL

Devolve uma cadeia com codificação URL.

Necessitamos da sua ajuda!