Extract Numbers from an IP address

swalker235

New Member
Hi

I'm struggling to extract the last 1,2 or 3 digits from an IP address. the problem I have is that I have different length of IP address, so for example

10.1.93.145
145.10.5.16
145.168.192.1

I am trying to extract the numbers after the last full stop so the above example results would be 145, 16 and 1

I have tried using =RIGHT and FIND but I am struggling to get it to consistently pull out just the last numerical values.

Has anyone got any suggestions please?

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

VoG

Legend
Try

=TRIM(RIGHT(SUBSTITUTE(A1,".",REPT(" ",255)),255))

swalker235

New Member
Both worked perfectly! Thank you so much.....I'm now going to try and unpick them to see if I can actually understand the forumula.....

Cheers both

snb_

Well-known Member
or

Code:
``=MID(A1,FIND("~",SUBSTITUTE(A1,".","~",3))+1,10)``

István Hirsch

Well-known Member
Or give this a try:

=LOOKUP(10^9,1*RIGHT(SUBSTITUTE(A1,".","x"),{1,2,3,4,5,6,7,8,9}))

swalker235

New Member
All of these solutions are working. Thanks for the quick response all.

Replies
21
Views
672
Replies
3
Views
152
Replies
1
Views
222
Replies
9
Views
130
Replies
2
Views
98

1,191,054
Messages
5,984,381
Members
439,883
Latest member
onions44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back