Solved

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

Posted on 2011-09-14
7
384 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
My experience with Windows 10 over a one year period and suggestions for smooth operation
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

803 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