Text Functions
This section contains descriptions of the Text functions.
CLEAN
All non-printing characters are removed from the string.
CLEAN(text)
text refers to the text from which to remove all non-printable characters.
ARABIC
Calculates the value of a Roman number. The value range must be between 0 and 3999.
ARABIC (Text)
Text is the text that represents a Roman number.
ARABIC("MXIV") returns 1014
ARABIC("MMII") returns 2002
PROPER
Capitalizes the first letter in all words of a text string.
PROPER(text)
text refers to the text to be converted.
PROPER("sun microsystems") returns Sun Microsystems.
CONCATENATE
Combines several text strings into one string.
CONCATENATE(Text 1;...;Text 30)
Text 1; text 2; ... represent up to 30 text passages which are to be combined into one string.
CONCATENATE("Good ";"Morning ";"Mrs. ";"Doe") returns Good Morning Mrs. Doe.
EXACT
Compares two text strings and returns TRUE if they are identical. This function is case-sensitive.
EXACT(text_1;text_2)
text_1 refers to the first text to compare.
text_2 is the second text to compare.
EXACT("Sun microsystems";"Sun Microsystems") returns FALSE.
UNICHAR
Converts a code number into a Unicode character or letter.
UNICHAR(number)
=UNICHAR(169) returns the Copyright character Β©.
See also the UNICODE() function.
ROMAN
Converts a number into a Roman numeral. The value range must be between 0 and 3999, the modes can be integers from 0 to 4.
ROMAN(Number; Mode)
Number is the number that is to be converted into a Roman numeral.
Mode (optional) indicates the degree of simplification. The higher the value, the greater is the simplification of the Roman number.
ROMAN(999) returns CMXCIX
ROMAN(999;0) returns CMXCIX
ROMAN (999;1) returns LMVLIV
ROMAN(999;2) returns XMIX
ROMAN(999;3) returns VMIV
ROMAN(999;4) returns IM
CHAR
Converts a number into a character according to the current code table. The number can be a two-digit or three-digit integer number.
CHAR(number)
number is a number between 1 and 255 representing the code value for the character.
CHAR(100) returns the character "d".
="abc" & CHAR(10) & "def" inserts a newline character into the string.
TEXT
Converts a number into text according to a given format.
TEXT(Number; Format)
Number is the numerical value to be converted.
Format is the text which defines the format. Use decimal and thousands separators according to the language set in the cell format.
=TEXT(12.34567;"###.##") returns the text 12.35
=TEXT(12.34567;"000.00") returns the text 012.35
See also Number format codes: custom format codes defined by the user.
BAHTTEXT
Converts a number to Thai text, including the Thai currency names.
BAHTTEXT(Number)
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.
BAHTTEXT(12.65) returns a string in Thai characters with the meaning of "Twelve Baht and sixty five Satang".
ΠΠΠΠΠ
Converts a number to an amount in the currency format, rounded to a specified decimal place. In the value field enter the number to be converted to currency. 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.
You set the currency format in your system settings.
DOLLAR(value; decimals)
value is a number, a reference to a cell containing a number, or a formula which returns a number.
decimals is the optional number of decimal places.
DOLLAR(255) returns $255.00.
DOLLAR(367.456;2) returns $367.46. Use the decimal separator that corresponds to the current locale setting.
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.
BASE(Number; Radix; [Minimum length])
number is the positive integer to be converted.
radix indicates the base of the number system. It may be any positive integer between 2 and 36.
Minimum length (optional) determines the minimum length of the character sequence that has been created. If the text is shorter than the indicated minimum length, zeros are added to the left of the string.
BASE(17;10;4) returns 0017 in the decimal system.
BASE(17;2) returns 10001 in the binary system.
BASE(255;16;4) returns 00FF in the hexadecimal system.
VALUE
Converts a text string into a number.
VALUE(text)
text is the text to be converted to a number.
VALUE("4321") returns 4321.
LOWER
Converts all uppercase letters in a text string to lowercase.
LOWER(text)
text refers to the text to be converted.
LOWER("Sun") returns sun.
DECIMAL
Converts text with characters from a number system to a positive integer in the base radix given. 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, is disregarded. If the radix is 2, an appended b or B is disregarded. Other characters that do not belong to the number system generate an error.
DECIMAL(Text; Radix)
text is the text to be converted. To differentiate between a hexadecimal number, such as A1 and the reference to cell A1, you must place the number in quotation marks, for example, "A1" or "FACE".
radix indicates the base of the number system. It may be any positive integer between 2 and 36.
DECIMAL("17";10) returns 17.
DECIMAL("FACE";16) returns 64206.
DECIMAL("0101";2) returns 5.
UPPER
Converts the string specified in the text field to uppercase.
UPPER(text)
text refers to the lower case letters you want to convert to upper case.
UPPER("Good Morning") returns GOOD MORNING.
LENB
For double-byte character set (DBCS) languages, returns the number of bytes used to represent the characters in a text string.
LENB("Text")
text is the text whose length is to be determined.
LENB("δΈ") returns 2 (1 DBCS character consisting of 2 bytes).
LENB("δΈε½") returns 4 (2 DBCS characters each consisting of 2 bytes).
LENB("office") returns 6 (6 non-DBCS characters each consisting of 1 byte).
=LENB("Good Afternoon") returns 14.
=LENB(12345.67) returns 8.
TRIM
Removes spaces from a string, leaving only a single space character between words.
TRIM(Text)
Text refers to text in which spaces are to be removed.
=TRIM(" hello world ") returns hello world without leading and trailing spaces and with single space between words.
REPT
Repeats a character string by the given number of copies.
REPT(text; number)
text is the text to be repeated.
number is the number of repetitions.
The result can be a maximum of 255 characters.
REPT("Good morning"; 2) returns Good morningGood morning.
REPLACE
Replaces part of a text string with a different text string. This function can be used to replace both characters and numbers (which are automatically converted to text). The result of the function is always displayed as text. If you intend to perform further calculations with a number which has been replaced by text, you will need to convert it back to a number using the VALUE function.
Any text containing numbers must be enclosed in quotation marks if you do not want it to be interpreted as a number and automatically converted to text.
REPLACE(text; position; length; new text)
Text refers to text of which a part will be replaced.
position refers to the position within the text where the replacement will begin.
length is the number of characters in text to be replaced.
new text refers to the text which replaces text.
REPLACE("1234567";1;1;"444") returns "444234567". One character at position 1 is replaced by the complete new text.
CODE
Returns a numeric code for the first character in a text string.
CODE(Text)
Text is the text for which the code of the first character is to be found.
CODE("Hieronymus") returns 72, CODE("hieroglyphic") returns 104.
The code used here does not refer to ASCII, but to the code table currently loaded.
UNICODE
Returns a numeric code for the first character in a text string.
UNICODE("Text")
=UNICODE("Β©") returns the Unicode number 169 for the Copyright character.
See also the UNICHAR() function.
MID
Returns a text segment of a character string. The parameters specify the starting position and the number of characters.
MID(text; start; number)
text is the text containing the characters to extract.
start is the position of the first character in the text to extract.
number specifies the number of characters in the part of the text.
MID("Sun Microsystems";5;5) returns Micro.
MIDB
Returns a text string of a DBCS text. The parameters specify the starting position and the number of characters.
MIDB("Text"; Start; Number_bytes)
text is the text containing the characters to extract.
Start is the position of the first character in the text to extract.
Number_bytes specifies the number of characters MIDB will return from text, in bytes.
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).
LEFTB
Returns the first characters of a DBCS text.
LEFTB("Text"; Number_bytes)
Text is the text where the initial partial words are to be determined.
Number_bytes (optional) specifies the number of characters you want LEFTB to extract, based on bytes. If this parameter is not defined, one character is returned.
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).
RIGHTB
Returns the last character or characters of a text with double bytes characters sets (DBCS).
RIGHTB("Text"; Number_bytes)
Text is the text of which the right part is to be determined.
Number_bytes (optional) specifies the number of characters you want RIGHTB to extract, based on bytes.
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).
RIGHTB("office";3) returns "ice" (3 non-DBCS characters each consisting of 1 byte).
LEN
Returns the length of a string including spaces.
LEN(text)
text is the text whose length is to be determined.
LEN("Good Afternoon") returns 14.
LEN(12345.67) returns 8.
FIND
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.
FIND(find_text; text; position)
find_text refers to the text to be found.
text is the text where the search takes place.
position (optional) is the position in the text from which the search starts.
FIND(76;998877665544) returns 6.
SEARCH
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).
SEARCH(find_text; text; position)
find_text is the text to be searched for.
text is the text where the search will take place.
position (optional) is the position in the text where the search is to start.
SEARCH(54;998877665544) returns 10.
FIXED
Specifies that a number be displayed with a fixed number of decimal places and with or without a thousands separator. This function can be used to apply a uniform format to a column of numbers.
FIXED(Number; decimals; no thousands separators)
Number refers to the number to be formatted.
Decimals refers to the number of decimal places to be displayed.
No thousands separators (optional) determines whether the thousands separator is used. If the parameter is a number not equal to 0, the thousands separator is suppressed. If the parameter is equal to 0 or if it is missing altogether, the thousands separators of your current locale setting are displayed.
FIXED(1234567.89;3) returns 1,234,567.890. FIXED(1234567.89;3;1) returns 1234567.890.
FIXED(1234567.89;3) returns 1,234,567.890. FIXED(1234567.89;3;1) returns 1234567.890.
SUBSTITUTE
Substitutes new text for old text in a string.
SUBSTITUTE(text; search_text; new text; occurrence)
text is the text in which text segments are to be exchanged.
search_text is the text segment that is to be replaced (a number of times).
new text is the text that is to replace the text segment.
occurrence (optional) indicates which occurrence of the search text is to be replaced. If this parameter is missing the search text is replaced throughout.
SUBSTITUTE("123123123"; "3"; "abc") returns 12abc12abc12abc.
SUBSTITUTE("123123123"; "3"; "abc"; 2) returns 12312abc123.
ASC
The ASC function converts full-width to half-width ASCII and katakana characters. Returns a text string.
See https://wiki.documentfoundation.org/Calc/Features/JIS_and_ASC_functions for a conversion table.
ASC("Text")
Text is the text that contains characters to be converted.
See also JIS function.
JIS
The JIS function converts half-width to full-width ASCII and katakana characters. Returns a text string.
See https://wiki.documentfoundation.org/Calc/Features/JIS_and_ASC_functions for a conversion table.
TRIM(Text)
Text is the text that contains characters to be converted.
See also ASC function.
T
This function converts a number to a blank text string.
T(value)
value is the value to be converted. Also, a reference can be used as a parameter. If the referenced cell includes a number or a formula containing a numerical result, the result will be an empty string.
T(12345) becomes an empty string "", if 12345 is formatted as a number. T("12345") returns 12345.
T(12345) becomes an empty string "", if 12345 is formatted as a number. T("12345") returns 12345.
RIGHT
ΠΠΎ Π²ΡΠ°ΡΠ° ΠΏΠΎΡΠ»Π΅Π΄Π½ΠΈΠΎΡ Π·Π½Π°ΠΊ ΠΈΠ»ΠΈ Π·Π½Π°ΡΠΈ ΠΎΠ΄ ΡΠ΅ΠΊΡΡΠΎΡ.
RIGHT(text; number)
text is the text of which the right part is to be determined.
number (optional) is the number of characters from the right part of the text.
RIGHT("Sun";2) returns un.
LEFT
ΠΠΎ Π΄Π°Π²Π° ΠΏΡΠ²ΠΈΠΎΡ Π·Π½Π°ΠΊ ΠΈΠ»ΠΈ Π·Π½Π°ΡΠΈ ΠΎΠ΄ ΡΠ΅ΠΊΡΡΠΎΡ.
LEFT(text; number)
text is the text where the initial partial words are to be determined.
Number (optional) specifies the number of characters for the start text. If this parameter is not defined, one character is returned.
LEFT("output";3) returns out.