Solved

Need to remove the last digits from a list of IP's in excel

Posted on 2011-09-14
7
385 Views
Last Modified: 2012-05-12
I have a list of ip's about 160 in one colum in an excel spread sheet.

I need to remove the last .xxx from the list of ip's and add a .0 at the end

example 192.168.1.100 - 192.168.1.0

so how can I preform this to change all the ips to remove the last 3 digits and replace it with a 0.

I really don't know excel.  

thanks

0
Comment
Question by:rdefino
7 Comments
 
LVL 50

Expert Comment

by:barry houdini
ID: 36536684
You can get the result with a formula in another column, e.g. with data in A2 down use this formula in B2 copied down

=IF(A2="","",LEFT(A2,LEN(A2)-3)&0)

If you want to replace the original results with those do this:

Copy column B then use Edit > Paste Special> Values to change column B to fixed data rather than formula results....now delete column A

regards, barry
0
 
LVL 23

Expert Comment

by:Brian B
ID: 36536696
This is a bit tricky, because as far as I know, the FIND() function onlys finds the first occurences of a character within a string. So it would require a nested set of MID() and FIND() functions to find the third dot.

I'm still working on it, but maybe that will get others started if someone else wants to contribute.
0
 
LVL 18

Expert Comment

by:Cluskitt
ID: 36536699
In column B (or add one if you have it filled with other stuff), add:
=LEFT(A1,10) & "0"
and copy/paint it down the last row. You can then copy/paste special->values to the column and delete the extra one.

If your ip domain changes (for example, 10.0.0.x) you need a different formula. But if they're all in the 192.168.1.x (or even up to 192.168.9.x) then this will do.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 23

Accepted Solution

by:
Brian B earned 125 total points
ID: 36536813
Okay, I got it. This will always work. If the column of IPs is in column A:

=LEFT(A1,FIND("x",SUBSTITUTE(A1,".","x",3))-1)&".0"
0
 
LVL 23

Expert Comment

by:Brian B
ID: 36536819
Unfortunately, the other solutions won't adapt to the number of digits in the individual octets changing.
0
 

Author Closing Comment

by:rdefino
ID: 36536865
Tbone2k,

Worked like a charm!

thanks
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 36538193
>Unfortunately, the other solutions won't adapt to the number of digits in the individual octets changing

That's partly true of mine.....

My solution works as long as there are 3 digits after the last .

The question did say "remove the last 3 digits and replace it with a 0"

Was the 3 variable then?

barry
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
copy same as above data 18 41
SKip past fields with no data 6 16
Index Match Array? 5 39
Need convert a number to 8 23
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question