Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • How to Create One and Two Variable Data Tables in Excel
  • Create Scatter Chart in Excel
  • Excel Line Chart
  • Remove Duplicates Example in Excel
  • How to create dynamic reference table name in Excel

References

  • How to get last row in numeric data in Excel
  • CHOOSE function: Description, Usage, Syntax, Examples and Explanation
  • How to get relative column numbers in a range in Excel
  • Lookup entire row in Excel
  • Count unique text values with criteria

Data Validations

  • Excel Data validation unique values only
  • Excel Data validation no punctuation
  • Excel Data validation exists in list
  • Excel Data validation date in next 30 days
  • Excel Data validation require unique number

How to extract substring in Excel

by

To extract a substring with an Excel formula, you can use the MID function.

Note: In this example, we are calculating the end position in order to extract a substring with a literal start and end position. However, if you know the number of characters to extract, you can just plug in that number directly.

 Formula

=MID(A1,start,end-start+1)

Explanation

In the example shown, the formula in E5 is:

=MID(B5,C5,D5-C5+1)

which, on row 5, returns “Perfect”.

How this formula works

In the example on this page, we are using the MID function to extract text based on a start and end position. The MID function accepts three arguments: a text string, a starting position, and the number of characters to extract. The text comes from column B, and the starting position comes from column C. The number of characters to extract is calculated by subtracting the start from end, and adding 1. In cell E6:

=MID(B5,C5,D5-C5+1)
=MID("Perfect is the enemy of good",1,7-1+1)
=MID(B5,1,7) // returns "Perfect"

Functions to extract substrings

Excel provides three primary functions for extracting substrings:

=MID(txt,start,chars) // extract from middle
=LEFT(txt,chars) // extract from left
=RIGHT(txt,chars) // extract from right

Finding start and end positions with a formula

In the example shown, start and end positions are based on hardcoded values. However, it is possible to calculate positions with the FIND function and SEARCH function.

Post navigation

Next Post:

Create One-dimensional and Two-dimensional Array

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • Extract multiple matches into separate rows in Excel
  • XOR function: Description, Usage, Syntax, Examples and Explanation
  • AND function: Description, Usage, Syntax, Examples and Explanation
  • IF, AND, OR and NOT Functions Examples in Excel
  • OR function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • DAYS360 function: Description, Usage, Syntax, Examples and Explanation
  • Get last weekday in month in Excel
  • Convert Excel time to decimal seconds
  • Get days, hours, and minutes between dates in Excel
  • How to get workdays between dates in Excel

Grouping

  • Calculate conditional mode with criteria in Excel
  • Map inputs to arbitrary values in Excel
  • Running count group by n size in Excel
  • How to randomly assign data to groups in Excel
  • Map text to numbers in Excel

General

  • Hide and Unhide Columns or Rows in Excel
  • How to count total number of cells in a rectangular range in Excel
  • How to calculate percent of students absent in Excel
  • Excel Autofill Cell Ranges, Copy, Paste
  • Advanced Number Formats in Excel
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning