The LEFT
function in Excel is used to extract a specified number of characters from the beginning (left side) of a text string. Below are 10 examples of how the LEFT
function can be used, including data and formulas:
Example 1: Basic Usage
Data:
Cell A1
: Hello World
Formula:=LEFT(A1, 5)
Result: Hello
Explanation: Extracts the first 5 characters from the text in A1
.
Example 2: Extract First Word
Data:
Cell A2
: Excel Functions
Formula:=LEFT(A2, FIND(" ", A2) - 1)
Result: Excel
Explanation: Finds the space character and extracts all characters before it.
Example 3: Extract File Extension
Data:
Cell A3
: report.xlsx
Formula:=LEFT(A3, FIND(".", A3) - 1)
Result: report
Explanation: Extracts the file name without the extension.
Example 4: Dynamic Length Extraction
Data:
Cell A4
: 12345-6789
Formula:=LEFT(A4, LEN(A4) - 5)
Result: 12345
Explanation: Extracts all characters except the last 5.
Example 5: Extract Year from Date
Data:
Cell A5
: 2023-10-15
Formula:=LEFT(A5, 4)
Result: 2023
Explanation: Extracts the first 4 characters (the year) from the date string.
Example 6: Extract First Initial
Data:
Cell A6
: John Doe
Formula:=LEFT(A6, 1)
Result: J
Explanation: Extracts the first character of the text.
Example 7: Combine with TRIM
Data:
Cell A7
: Trim Example
Formula:=LEFT(TRIM(A7), 4)
Result: Trim
Explanation: Trims leading spaces and extracts the first 4 characters.
Example 8: Extract Currency Symbol
Data:
Cell A8
: $100.50
Formula:=LEFT(A8, 1)
Result: $
Explanation: Extracts the first character, which is the currency symbol.
Example 9: Extract First Name from Full Name
Data:
Cell A9
: Jane Smith
Formula:=LEFT(A9, FIND(" ", A9) - 1)
Result: Jane
Explanation: Finds the space and extracts all characters before it.
Example 10: Extract Area Code from Phone Number
Data:
Cell A10
: (123) 456-7890
Formula:=LEFT(A10, FIND(")", A10) - 1)
Result: (123
Explanation: Extracts the area code from the phone number.
These examples demonstrate the versatility of the LEFT
function in Excel. You can combine it with other functions like FIND
, LEN
, and TRIM
to achieve more advanced text manipulation.
No comments:
Post a Comment