How to use LEFT RIGHT MID Functions in Excel

Excel’s LEFT RIGHT MID functions are indispensable tools for extracting specific parts of text from cells. Whether you’re cleaning up data, analyzing strings, or creating dynamic text-based reports, these functions simplify tasks that would otherwise take hours.

In this guide, we’ll explore the LEFT RIGHT MID functions in detail, demonstrate practical use cases, and show how tools like ChatGPT and Microsoft Copilot can make your work even more efficient.

What Are the LEFT, RIGHT, and MID Functions?

1. LEFT Function

The LEFT function extracts a specified number of characters from the beginning (left) of a text string.

Syntax:

=LEFT(text, num_chars)

  • text: The string to extract characters from.
  • num_chars: The number of characters to extract.

Example:

=LEFT(“ExcelMastery”, 5)

Result: “Excel”

2. RIGHT Function

The RIGHT function extracts a specified number of characters from the end (right) of a text string.

Syntax:

=RIGHT(text, num_chars)

  • text: The string to extract characters from.
  • num_chars: The number of characters to extract.

Example:

=RIGHT(“ExcelMastery”, 7)

Result: “Mastery”

3. MID Function

The MID function extracts a specific number of characters starting at a defined position within a text string.

Syntax:

=MID(text, start_num, num_chars)

  • text: The string to extract characters from.
  • start_num: The position to start extracting from.
  • num_chars: The number of characters to extract.

Example:

=MID(“ExcelMastery”, 6, 6)

Result: “Master”

Why Use LEFT, RIGHT, and MID?

These functions are essential for:

  • Text Cleaning: Removing unwanted prefixes, suffixes, or extracting meaningful parts of a string.
  • Data Transformation: Converting complex data into actionable formats.
  • Dynamic String Manipulation: Handling variable-length strings for custom reporting or analysis.
Step-by-Step Guide with Examples

Example 1: Extract First Name Using LEFT

Suppose you have full names in column A, and you want to extract the first name.

Data:

Full Name

John Smith

Mary Johnson

Formula:

=LEFT(A1, FIND(” “, A1) – 1)

Explanation:

  • FIND(” “, A1) finds the position of the space character.
  • Subtract 1 to exclude the space.
  • LEFT extracts all characters up to that position.

Result:

  • John
  • Mary

Example 2: Extract File Extensions Using RIGHT

You have file names with extensions, and you want to extract just the extensions.

File Name

report.xlsx

presentation.pptx

Formula:

=RIGHT(A1, LEN(A1) – FIND(“.”, A1))

Explanation:

  • FIND(“.”, A1) finds the position of the period.
  • LEN(A1) gives the total length of the string.
  • RIGHT extracts all characters from the position of the period to the end.

Result:

  • xlsx
  • pptx

Example 3: Extract Middle Initial Using MID

You have names with middle initials, and you want to extract just the middle initial.

Full Name

John A. Smith

Mary B. Johnson

Formula:

=MID(A1, FIND(” “, A1) + 1, 1)

Explanation:

  • FIND(” “, A1) locates the first space.
  • Add 1 to start extracting from the middle initial.
  • MID extracts 1 character.

Result:

  • A
  • B
Advanced Use Cases for LEFT, RIGHT, and MID

1. Extracting Area Codes from Phone Numbers

If you have phone numbers formatted like (123) 456-7890, extract the area code.

Formula:

=MID(A1, 2, 3)

2. Dynamic Truncation for Product Codes

You have product codes like ABC-12345 and need to extract the numeric part.

Formula:

=RIGHT(A1, LEN(A1) – FIND(“-“, A1))

3. Combine with Other Functions

Use LEFT, RIGHT, and MID with functions like IF, LEN, and TRIM for more advanced logic.

Example: Extract Prefix for Conditional Formatting

=IF(LEFT(A1, 3) = “EMP”, “Employee”, “Other”)

Common Mistakes and How to Avoid Them
  1. Incorrect Start Position in MID: Ensure start_num is greater than 0; otherwise, MID will return an error.
  2. Out-of-Bounds Characters: If num_chars exceeds the string length, the functions won’t throw an error—they’ll just return the entire string.
  3. Case Sensitivity in Logical Tests: When using extracted text in comparisons, remember that Excel is case-sensitive. Use UPPER or LOWER to normalize text.
DeYuCo Academy Excel LEFT MID RIGHT Function
How ChatGPT and Copilot Simplify Text Extraction

1. Generate Custom Formulas with ChatGPT

ChatGPT is an excellent tool for generating formulas based on your requirements.

Example: “How do I extract the last 4 characters from a string in cell A1?”

ChatGPT Suggestion:

=RIGHT(A1, 4)

2. Debugging Complex Formulas

If your formula isn’t working, ChatGPT can debug it.

Example: Why isn’t my formula =LEFT(A1, FIND(”-”, A1)) working?”

ChatGPT Insight: It will explain that FIND is locating the position of the hyphen, but you need to subtract 1 to avoid including it.

3. Automating Reports with Copilot

Microsoft Copilot in Excel can automate repetitive text extraction tasks.

Example Workflow with Copilot:

  1. Describe Your Goal: “Extract the domain names from a list of email addresses in column A.”
  2. Automated Formula Creation: Copilot generates: =MID(A1, FIND(“@”, A1) + 1, LEN(A1) – FIND(“@”, A1))
  3. Dynamic Report Generation: Copilot creates a summary table showing unique domains and counts.

4. Handling Large Datasets

With Copilot, you can batch-process text extractions, such as splitting names into first and last names for thousands of rows.

Example:“Split full names into two columns for first and last names.”

Copilot can generate a LEFT/MID/RIGHT formula for the first name and dynamically apply it across the dataset.

5. Suggesting Alternatives

If LEFT, RIGHT, or MID aren’t the best fit, ChatGPT and Copilot can recommend other tools like TEXTSPLIT (in Excel 365).

Example:Is there a better way to extract text before and after a hyphen?”

Suggested Alternative:

=TEXTSPLIT(A1, “-“)

Conclusion

The LEFT, RIGHT, and MID functions are powerful tools for text extraction and manipulation in Excel. Whether you’re cleaning up data, analyzing strings, or building reports, these functions simplify otherwise tedious tasks.

With the added support of tools like ChatGPT and Microsoft Copilot, you can further streamline your workflows:

  • ChatGPT helps generate, debug, and explain complex formulas.
  • Copilot automates repetitive tasks, builds dynamic reports, and handles large datasets with ease.

Start practicing these functions today, and let AI tools like ChatGPT and Copilot elevate your Excel skills to the next level. If you found this guide helpful, share it with your team and stay tuned for more Excel tips and tricks!

Newsletter Signup

Sign up to receive our latest news, updates, tools, tips and freebies!

We don’t spam! Read our privacy policy for more info.

DeYuCo Academy Free Prompt Collection Persuasive Emails
DeYuCo Academy Free Prompt Collection Persuasive Emails
Don't miss this chance!

SUBSCRIBE to our newsletter and receive this FREE Persuasive Emails PROMPT collection!

We don’t spam! Read our privacy policy for more info.

Scroll to Top