These functions help manipulate and format text in Excel.
The TEXT
function converts a number into a formatted text string.
=TEXT(value, format_text)
value
→ The number or cell to format.format_text
→ The format to apply (e.g., "MM/DD/YYYY"
, "$#,##0.00"
).Format a date as "Month Day, Year"
:
=TEXT(A1, "MMMM DD, YYYY")
01/01/2024
, result → "January 01, 2024"
Format a number as currency:
=TEXT(A1, "$#,##0.00")
1234.5
, result → "$1,234.50"
The LEFT
function returns a specific number of characters from the beginning (left side) of a text string.
=LEFT(text, num_chars)
text
→ The text or cell to extract from.num_chars
→ Number of characters to extract.Extract the first 3 characters of "Excel"
:
=LEFT("Excel", 3)
Result: "Exc"
Extract first 2 characters from A1:
=LEFT(A1, 2)
"Product123"
, result → "Pr"
The RIGHT
function returns a specific number of characters from the end (right side) of a text string.
=RIGHT(text, num_chars)
Extract the last 3 digits of a phone number ("123456789"
):
=RIGHT("123456789", 3)
Result: "789"
Extract the last 4 characters from A1:
=RIGHT(A1, 4)
"Invoice2024"
, result → "2024"
The MID
function extracts a substring from the middle of a text, based on a start position and length.
=MID(text, start_num, num_chars)
text
→ The text or cell to extract from.start_num
→ Position of the first character to extract.num_chars
→ Number of characters to extract.Extract "cro" from "Microsoft"
:
=MID("Microsoft", 3, 3)
Result: "cro"
Extract 5 characters starting from the 4th position in A1:
=MID(A1, 4, 5)
"Product123"
, result → "duct1"
Function | Purpose | Example | Result |
---|---|---|---|
TEXT |
Format numbers as text | =TEXT(1234.5, "$#,##0.00") |
"$1,234.50" |
LEFT |
Extract from the left | =LEFT("Excel", 3) |
"Exc" |
RIGHT |
Extract from the right | =RIGHT("Excel", 2) |
"el" |
MID |
Extract from the middle | =MID("Microsoft", 3, 3) |
"cro" |