5

I want to generate a specific range of IP from 192.168.1.0 to 192.168.255.255

How can I do that job in Microsoft Excel?

I used these formulas, but not work for all range of IP address:

Excel IP Addresses Increment the Third Octet
="10.1."&ROWS($A$1:A1)&".1"
Excel IP Addresses Increment the Fourth Octet
="10.1.1."&ROWS($A$1:A1)
1
  • You should be able to do so using 3 loops. First loop: run the fourth octet from 0 to 255 - Second loop: once the fourth octet reaches 255, reset the variable for the fourth octet to 0 and add 1 to the variable for the third octet - Third loop: when your variable for the third octet reaches 255, exit the loop. Structure being third loop>second loop>first loop
    – CustomX
    Feb 18, 2015 at 7:49

2 Answers 2

6

Your starting IP address is 10.1.1.1. That is 0A010101 IN HEX. Put that in a cell, let's say A2. Put this formula in B2,

=HEX2DEC(LEFT(A2, 2))&"."&HEX2DEC(MID(A2, 3, 2))&"."&HEX2DEC(MID(A2, 5, 2))&"."&HEX2DEC(RIGHT(A2, 2))

Now put this formula in A3,

=DEC2HEX(HEX2DEC(A2)+1, 8)

Copy the formula from B2 to B3 then fill A3:B3 down as far as you want.

    IP Addresses

1
  • Btw, 192.168.1.0 is C0A50100.
    – user4039065
    Feb 18, 2015 at 8:38
1

here's an elementary solution

in A1 put 1000 for starting at 1.0 or 0 for srating at 0.0

in A2 put =A1+IF(MOD(A1,1000)<255,1,745)

in B1 put ="192.168." & QUOTIENT(A1,1000) & "." & MOD(A1,1000) (of course the "192.168." part is your first two octet, modify it to taste)

copy the formula from B1 to B2 then fill A2:B2 down and voilà.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.