Creation of IP Address Ranges

meppwc

Well-known Member
Joined
May 16, 2003
Messages
626
Office Version
  1. 365
Platform
  1. Windows
I am trying to automate the ability to create IP address ranges
An example
Cell A1 has the value of 10.127.65.16
In cell B1 I want to keep the first 3 octets and replace the last octet with 10 (end result for B1 is 10.127.65.10)
In cell C1 I want to keep the first 3 octets and replace the last octet with 99 (end result for C1 is 10.127.65.99)

Is there a way of accomplishing this with formulas in B1 and C1 ?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You could use:

=TRIM(LEFT(SUBSTITUTE(A1,".",REPT(" ",1000),3),1000))&".10"
=TRIM(LEFT(SUBSTITUTE(A1,".",REPT(" ",1000),3),1000))&".99"
 
Upvote 0
How about
=TRIM(LEFT(SUBSTITUTE(A1,".",".10"&REPT(" ",10),3),15))
=TRIM(LEFT(SUBSTITUTE(A1,".",".99"&REPT(" ",10),3),15))
 
Upvote 0
Thank you both so much. This will save me tons of time.
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,737
Messages
6,180,665
Members
452,992
Latest member
TokugawaIesuma

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?

Disable AdBlock

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

Disable AdBlock Plus

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
Back
Top