Description
Use this function to extract a specified number of characters from the start of a text string. Supported in Chains.
This is useful for isolating specific parts of text data, such as area codes from phone numbers or the first few letters of names.
Syntax
LEFT(text, [num_chars])
Inputs
This function accepts the following arguments:
| Name | Required | Description | Valid input |
|---|---|---|---|
text |
Yes | The text string from which you want to extract characters. | A cell reference, a number, a text string, or a formula which results in any of these. |
num_chars |
No | The number of characters you want to extract from the start of the text. | A positive integer, a cell reference containing a positive integer, or a formula which results in either of these. If omitted, defaults to 1. |
Example
Sample data
| A | B |
|---|---|
| 1 | Workiva |
| 2 | 01 (123) 456-7890 |
| 3 | John Doe |
| 4 | ABC123 |
| 5 May 2024 | 4/6/2024 |
| eggplant | The quick brown fox |
Sample formulas
| Formula | Description | Result |
|---|---|---|
=LEFT(B6, 3) |
Returns the first 2 characters from cell B1. | egg |
=LEFT(B2, 3) |
Extracts the area code from the phone number in cell B2. | 123 |
=LEFT(B4) |
Returns the leftmost character from cell B4 (num_chars omitted). |
A |
=LEFT(B1, 10) |
Attempts to return 10 characters, but cell B1 has only 8. | Workiva |
=LEFT(B5, A4) |
Returns the first n characters from cell B5 using the value in cell A4 as the value for n. In this case, as this is a date, this will be the first 4 digits of the Julian date. | 4538 |
=LEFT(A5, 5) |
Returns the leftmost 8 characters from cell A5. This date is in text format. | 5 May |
=LEFT(B1, LEN(B1)-3) |
Returns all but the last 3 characters from cell B1. | Work |
=LEFT(A2,FIND(" ", A2, LEN(A2)-LEN(SUBSTITUTE(A2, " ", "")))-1) |
Returns all but the first word. | The |
Notes
- If
num_charsis greater than the length of text, LEFT returns the entire text. - If
num_charsis omitted, it defaults to 1, returning only the first character. - If
num_charsis 0, LEFT returns a blank cell. - LEFT treats each character, including spaces and punctuation, as one unit.
- For non-text inputs, LEFT attempts to convert the value to text before processing.
- LEFT can be nested within other functions or combined with other text functions for more complex text manipulation.
- IF LEFT returns an unexpected "0" response, it is most likely due to a circular cell reference or a non-printing character in the cell.
Tips
- Use LEFT in combination with LEN to extract all but the last n characters of a string.
- Combine LEFT with FIND or SEARCH to extract substrings up to a specific character or delimiter.
- When working with dates stored as text, use LEFT to extract the year or month.
- For extracting characters from the end of a string, use the RIGHT function instead.
- Use LEFT with the SUBSTITUTE function to remove unwanted characters from the beginning of a text string.
Related functions
CHAR
CODE
CONCATENATE
CONCATENATEIF
FIND
LEFT
LEN
LOWER
MID
PROPER
REPT
RIGHT
SEARCH
SUBSTITUTE
TEXT
TEXTJOIN
TRIM
UNICHAR
UNICODE
UPPER