Skip to main content

How to extract string from IP address in Excel?

If you have a list of IP addresses, and you want to extract the first three characters string only from these IP addresses in Excel, you can do as below tutorial.

Extract character string from IP address by formula

Extract character string from IP address by Text to Column

Extract character string from IP address by Kutools for Excel good idea3


arrow blue right bubble Extract character string from IP address

Here I introduce some formulas to extract string based on dot from IP address in Excel.

Select a cell then type one of below formulas as you need.

1. Extract string before first dot

Select a cell and type =MID(A2,1,FIND(".",A2,1)-1), press Enter key then drag the fill handle to the cells you need. See screenshot:
doc-extract-string-from-ip-1

2. Extract string between first and second dots

Select a cell and type =MID(A2,FIND(".",A2)+1,FIND(".",A2,(FIND(".",A2)+1)-FIND(".",A2))-1), press Enter key then drag the fill handle to the cells you need. See screenshot:
doc-extract-string-from-ip-2

3. Extract string between second and third dots

Select a cell and type =MID(A2,FIND(".",A2,FIND(".",A2)+1)+1,FIND(".",A2,FIND(".",A2,FIND(".",A2)+1)+1)-FIND(".",A2,FIND(".",A2)+1)-1), press Enter key then drag the fill handle to the cells you need. See screenshot:
doc-extract-string-from-ip-3

4. Extract string after last dot

Select a cell and type =MID(A2,FIND(".",A2,FIND(".",A2,FIND(".",A2)+1)+1)+1,LEN(A2)-FIND(".",A2,FIND(".",A2,FIND(".",A2)+1)+1)+1), press Enter key then drag the fill handle to the cells you need. See screenshot:
doc-extract-string-from-ip-4


arrow blue right bubble Extract character string from IP address by Text to Column

In Excel, the Text to Column also can quickly extract character string from IP address.

1. Select the IP addresses, and click Data > Text to Columns. See screenshot:
doc-extract-string-from-ip-5

2. In the Convert Text to Columns Wizard dialog, check Delimited option, then click Next and then check Other and type dot sign . into the next textbox in Delimiters section. See screenshot:

doc-extract-string-from-ip-6
doc-arrow
doc-extract-string-from-ip-7

3. Click Finish. Then you can see the IP addresses are split by dot sign.

doc-extract-string-from-ip-8

Note:

Using Text to Column will break the original data, you had better copy and paste the original to other location first.


arrow blue right bubble Extract character string from IP address by Kutools for Excel

To split cells by a defined delimiter with Text to Column needed several steps, but if you have Kutools for Excel, you can quickly split character string from IP address by the Split Cells utility.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After free installing Kutools for Excel, please do as below:

1. Select the IP address cells, and click Kutools > Merge & Split > Split Cells. See screenshot:
doc extract string from ip 9

2. Then in the Split Cells dialog, check Split to Columns, and go to chek Other option and type dot sign . into the textbox under Split by section. See screenshot:
doc split cells 2

3. Click Ok. And to select a cell to output the result.
doc split cells 3

4. Click OK. Now the IP address are split by dot.
doc split cells 4

 

Relative Articles:

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (3)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Little formula correction for the "Extract string between first and second dots" to handle bug when there is only one characters between the first & second dot: =MID(B2; FIND(".";B2)+1; (FIND("."; B2; (FIND("."; B2)+1)) - (FIND("."; B2)+1)))
This comment was minimized by the moderator on the site
same here just came back to write the correction and saw this

my correction was actually a little different
=MID(A2,FIND(".",A2)+1,FIND(".",A2,(FIND(".",A2)+1))-FIND(".",A2)-1)
This comment was minimized by the moderator on the site
Yes. I wish I had seen your correction before I spent a full day coming up with the same solution for one or two characters between the first and second dots. I didn't see your note until I thought I should post that there is a bug and scrolled down to see that you found it 3 years ago!!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations