Return all characters after and including nth character
This tutorial shows how to extract all characters after and including the nth character from a string through the use of an Excel formula, with the MID and LEN functions or VBA
EXCEL FORMULA 1. Return all characters after and including nth character using the MID and LEN functions
EXCEL
GENERIC FORMULA
=MID(string,nth_char,LEN(string))
ARGUMENTS GENERIC FORMULA
=MID(string,nth_char,LEN(string))
ARGUMENTS EXPLANATION This formula uses the MID and LEN functions to extract all of the characters from a string after and including the nth character.
Click on either the Hard Coded or Cell Reference button to view the formula that either has the number that represents the nth character after and including which you want to extract all the characters from a string entered directly in the formula or referenced to a cell.
In this example we are extracting all of the characters after and including the third (3rd) character, from the left, from a string captured in cell B5. |
Dim ws As Worksheet
ws.Range("C5") = Mid(ws.Range("B5"), 3, Len(ws.Range("B5")))
End Sub
Dim ws As Worksheet
ws.Range("D5") = Mid(ws.Range("B5"), ws.Range("C5"), Len(ws.Range("B5")))
End Sub
Dim ws As Worksheet
'extract all character after and including the 3rd character from a string
ws.Range("C" & x) = Mid(ws.Range("B" & x), 3, Len(ws.Range("B" & x)))
Next x
End Sub
Dim ws As Worksheet
'extract all character after and including the 3rd character from a string
ws.Range("D" & x) = Mid(ws.Range("B" & x), ws.Range("C" & x), Len(ws.Range("B" & x)))
Next x
End Sub
Related Topic | Description | Related Topic and Description |
---|---|---|
Return nth character | How to extract the nth character from a string through the use of an Excel formula or VBA | |
Insert a value before first nth character | How to insert a value before the first nth character through the use of an Excel formula or VBA | |
Insert a value after last nth character | How to insert a value after the last nth character through the use of an Excel formula or VBA |
Related Functions | Description | Related Functions and Description |
---|---|---|
MID Function | The Excel MID function returns the specified number of characters from a selected string, starting at a specified position | |
LEN Function | The Excel LEN function returns the number of characters in a specified string |