+ Reply to Thread
Results 1 to 8 of 8

Accumulate an IP address, in the last octet by +1

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    3

    Accumulate an IP address, in the last octet by +1

    Hello,

    I have been searching for an answer to this for awhile. I have found variations of this question, but I have not been able to find quite what I need. Perhaps someone can help?

    I have a cell (B10) that has an IP address in it. I want cell B11 to automatically reflect the same first 3 octets of B10, but the last octet accumulated by +1.

    Example: 172.23.0.128 would be in B10. I would like to have a formula in B11 to increment B10 by +1 to show 172.23.0.129.

    Does that make sense what I am looking for?

    Thanks!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Accumulate an IP address, in the last octet by +1

    The easy way would be to split the bytes into separate columns using text to columns.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Accumulate an IP address, in the last octet by +1

    what do you want to do if the octet is 255?
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  4. #4
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Accumulate an IP address, in the last octet by +1

    Formula in B11 would be

    =CONCATENATE(LEFT((VALUE(CONCATENATE(LEFT(B10,3),MID(B10,5,2),MID(B10,8,1),RIGHT(B10,3)))+1),3)& ".",MID((VALUE(CONCATENATE(LEFT(B10,3),MID(B10,5,2),MID(B10,8,1),RIGHT(B10,3)))+1),4,2) & ".",MID((VALUE(CONCATENATE(LEFT(B10,3),MID(B10,5,2),MID(B10,8,1),RIGHT(B10,3)))+1),6,1) & ".",RIGHT((VALUE(CONCATENATE(LEFT(B10,3),MID(B10,5,2),MID(B10,8,1),RIGHT(B10,3)))+1),3))

    It's a bit clutzy but it when pasted down through column B will give you all incremental values of IP address to 99999999
    Elegant Simplicity............. Not Always

  5. #5
    Registered User
    Join Date
    04-25-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Accumulate an IP address, in the last octet by +1

    AndyLitch

    It would appear that did not work.

    B10 contained 172.23.20.0
    Upon placing the formula in B11 the result was 172.23.2.321

    To answer the other question, the last octet of the IP would never exceed 255, so an additional condition is not needed.

    ?

  6. #6
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Accumulate an IP address, in the last octet by +1

    The formula required consistent (fixed length) formatting....I thought IP addresses were formatted that way...My mistake

  7. #7
    Registered User
    Join Date
    04-25-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Accumulate an IP address, in the last octet by +1

    I do see now how what you provided was correct based on the IP I provided you. So what this basically means (I am guessing) is that dependant on the amount of digits in the originating number would determine the formula used.

    I think I am starting to get it, but modifying the formula is probably going to be the hangup for me moving forward.

    Is it dependant on the amount of digits? If so then I think I would actually only need to know the formula for the third octet being 2 characters, as well the formula for the 3rd octet being 3 characters.

    Thank you very much!

  8. #8
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Accumulate an IP address, in the last octet by +1

    So the consistent feature of an IP address is the number of stops ..(3) so we need to
    1. find the position of that 3rd sto
    2. Take the digits after it (Right)
    3. Increment by 1 but only up to 255
    4. Recompose the string ...
    ........... I don't have the answer to step 1 but i do know it's out there

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1