The LEFT function extracts a specified number of characters from the left side of a text string. This guide explains how LEFT works and includes practical examples you can use immediately.
WHAT THE LEFT FUNCTION DOES
LEFT pulls characters from the beginning of a text string, making it ideal for extracting prefixes, area codes, product categories, or any fixed-length identifier that appears at the start of text. It's commonly used for parsing structured data or cleaning up imported text.
WHEN TO USE LEFT
- You want to extract area codes from phone numbers
- You need to get the first few characters of product codes or IDs
- You're separating first names from full names
- You want to extract prefixes or abbreviations from text
FORMULA SYNTAX
LEFT(text, num_chars)| Argument | Description |
|---|---|
text | The text string from which you want to extract characters |
num_chars | Number of characters to extract from the left |
EXAMPLE 1: EXTRACT AREA CODES FROM PHONE NUMBERS
We want to get the 3-digit area code from phone numbers.
| A | B | |
|---|---|---|
| 1 | Phone Number | Area Code |
| 2 | 415-555-1234 | =LEFT(A2,3) |
| 3 | 212-555-9876 | =LEFT(A3,3) |
| 4 | 310-555-4567 | =LEFT(A4,3) |
=LEFT(A2, 3)Result: 415, 212, 310 (first 3 characters from each phone number)
Need help applying this? Try this in Numstro Builder
EXAMPLE 2: EXTRACT PRODUCT CATEGORY FROM SKUS
We want to get the 2-letter product category from SKU codes.
| A | B | |
|---|---|---|
| 1 | SKU | Category |
| 2 | EL12345 | =LEFT(A2,2) |
| 3 | CL98765 | =LEFT(A3,2) |
| 4 | SH54321 | =LEFT(A4,2) |
=LEFT(A2, 2)Result: EL (Electronics), CL (Clothing), SH (Shoes)
Need help applying this? Try this in Numstro Builder
COMMON MISTAKES & EDGE CASES
- If num_chars exceeds the text length, LEFT returns the entire string
- If num_chars is 0, LEFT returns an empty string
- Negative num_chars will cause a #VALUE! error
- LEFT counts spaces and special characters as characters
- Use TRIM first if you need to remove extra spaces
RELATED FUNCTIONS
FURTHER READING
Official Microsoft documentation:
LEFT — Microsoft Support