Length and Position Functions

Length and position functions allow you to determine the length of a text string, or return a certain part of a string.

LEN (text): Returns the number of characters in the text string, including spaces.

LEFT (text, num_char): Returns the leftmost characters from the text string. The number of characters to return (num_char) can be specified; if num_char is omitted, one character will be returned.

RIGHT (text, num_char): Returns the rightmost characters from the text string. The number of characters to return (num_char) can be specified; if num_char is omitted, one character will be returned.

MID (text, start_position, num_chars): Returns the specified number of characters (num_chars) from the text string, beginning with the start_position. Note that the first character in the string has position 1.  

Examples:

Formula

Result

=LEN("John Doe")

8

=LEFT("EasyOffice")

E

=LEFT("EasyOffice", 4)

Easy

=RIGHT("EasyOffice")

e

=MID("dragonfly", 1, 5)

dragon

=MID("abcde", 2, 3)

bcd

=MID("abcde", 2, 7)

bcde

 

Byte Functions

EasySpreadsheet includes length and position functions that use bytes rather than characters. Standard characters and symbols are one byte, while some foreign language characters (e.g., Chinese) are two bytes.

LENB (text): Returns the number of bytes in the text string, including spaces.

LEFTB (text, num_bytes): Returns the leftmost byte from the text string. The number of bytes to return (num_bytes) can be specified; if num_bytes is omitted, one byte will be returned.

RIGHTB (text, num_bytes): Returns the rightmost bytes from the text string. The number of bytes to return (num_bytes) can be specified; if num_bytes is omitted, one byte will be returned.

MIDB (text, start_position, num_bytes): Returns the specified number of bytes (num_bytes) from the text string, beginning with the start_position.