String functions

String functions are functions that have a non-numerical result. A string is a sequence of characters not interpreted as a number, e.g. Jones, "25".

CELL Cell text/formula function

CELL(column,row) returns the contents of the cell with coordinates column and row as text.

CELL(A,5) returns the text 5*6 when cell A5 contains 5*6.

CHAR Character function

CHAR(x) returns the character with ANSI code x. The result is a string value of length 1 (if x>0).

CHAR(65.0) returns the string value 'A'

See table: ANSI character set.

CODE Character to ANSI code conversion

CODE(str) returns the ANSI code number of the first character of the string str. If the length of the string is 0, i.e. the string is empty, then the function returns 0.

CODE("Andy") returns 65.00

See table: ANSI character set.

CONCAT Concatenate strings

CONCAT(str1,str2,...) joins two or more strings (text items) into one single string.

CONCAT("Total ","value") returns "Total value".

LEFT Left portion of string

LEFT(str,n) returns the first n characters of str. If n equals 0, then the LEFT function returns an empty string. If n is equal to or more than the length of the string str, the function returns the complete string.

LEFT("Position",3) returns "Pos"

LEN Length of string

LEN(str) returns the length of the string str.

LOWER Lowercase function

LOWER(str) converts the string str to lowercase.

LOWER('TOTAL') returns "total"

MID Middle portion of a string

Returns a specific number of characters from a text string, starting from a specified position. MID(str,pos,n) returns middle n characters from str starting at position pos. The first character has position number 1, and so on.

MID("statistics,3,4) returns "atis"

REPT Repeat function

REPT(str,n) creates a string consisting of str repeated n time.

REPT("*",5) returns "*****"

RIGHT Right portion of a string

RIGHT(str,n) returns the last n characters of str. If n equals 0, then the RIGHT function returns an empty string. If n is equal to or more than the length of the string str, the function returns the complete string.

STR Number to string conversion

STR(x,n) returns the numeric value x as a string, with n decimal places.

STR(25.56,1) returns the string value "25.6"

UPPER Uppercase function

UPPER(str) converts the string str to uppercase.

UPPER('total') returns "TOTAL"

VALUE String to number conversion

VALUE(str) evaluates str as a number.

VALUE("25.0") returns 25.0
VALUE("text") returns an error

See also