How to Evaluate Formulas Step by Step in Microsoft Excel
Extracting a substring in Microsoft Excel depends on where the text is located in the cell. Excel provides functions like LEFT, RIGHT, MID, LEN, and FIND to help extract specific portions of text.
1. Extract Text from the Left
Use the LEFT function along with FIND to extract all text before a specific character.
Formula:
excelCopyEdit=LEFT(B2, FIND("@", B2) - 1)
How It Works:
FIND("@", B2)
finds the position of@
in cell B2.LEFT(B2, FIND("@", B2) - 1)
extracts everything before@
.
Example:
A (Full Text) | B (Extracted Text) |
---|---|
[email protected] | john |
2. Extract Text from the Right
Use the RIGHT function along with LEN and FIND to extract text after a specific character.
Formula:
excelCopyEdit=RIGHT(B2, LEN(B2) - FIND("@", B2))
How It Works:
FIND("@", B2)
finds the position of@
.LEN(B2)
gets the total length of the text.RIGHT(B2, LEN(B2) - FIND("@", B2))
extracts everything after@
.
Example:
A (Full Text) | B (Extracted Text) |
---|---|
[email protected] | example.com |
3. Extract a Substring from the Middle
Use the MID function to extract a specific number of characters from a text.
Formula:
excelCopyEdit=MID(B2, 1, 3)
How It Works:
B2
is the text.1
is the starting position (1st character).3
is the number of characters to extract.
Example:
A (Full Text) | B (Extracted Text) |
---|---|
Microsoft | Mic |
Summary
Function | Use Case | Example |
---|---|---|
LEFT | Extract text before a character | LEFT(B2, FIND("@", B2) - 1) |
RIGHT | Extract text after a character | RIGHT(B2, LEN(B2) - FIND("@", B2)) |
MID | Extract text from the middle | MID(B2, 1, 3) |
With these functions, you can easily extract names, domains, codes, or any part of a string in Excel!