+ Reply to Thread
Results 1 to 7 of 7

Working with multiple delimiters in a string

Hybrid View

ammauric Working with multiple... 04-12-2011, 01:30 PM
martindwilson Re: Working with multiple... 04-12-2011, 02:22 PM
ammauric Re: Working with multiple... 04-13-2011, 08:58 AM
martindwilson Re: Working with multiple... 04-13-2011, 09:44 AM
ammauric Re: Working with multiple... 04-13-2011, 09:54 AM
martindwilson Re: Working with multiple... 04-13-2011, 10:06 AM
ammauric Re: Working with multiple... 04-13-2011, 10:12 AM
  1. #1
    Registered User
    Join Date
    04-08-2011
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2010
    Posts
    5

    Working with multiple delimiters in a string

    I'm working on creating an automatically generated procedure for computer setup, and where I'm at right now is automatically generating a subnet mask based on IP address and gateway.

    So, I have two strings I need to compare the first three sets of numbers of, e.g. 172.18.1.160 and 172.18.0.9 which should generate 255.255.254.0

    The actual comparison and generation of the subnet mask is the simple part - I just want to do the comparison without splitting everything into more columns, and limit it to the cell the subnet will be output into if possible.

    Thanks for any help, it's greatly appreciated!
    Last edited by ammauric; 04-13-2011 at 10:13 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Working with multiple delimiters in a string

    more examples of different subnets please are you saying
    172.18.1.160 and 172.18.1.9 should give 255.255.255.0
    i hate 3rd octet calculations
    Last edited by martindwilson; 04-12-2011 at 02:27 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    04-08-2011
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Working with multiple delimiters in a string

    yes, 172.18.1.160 and 172.18.1.9 would be 255.255.255.0

    so each of the three calculations would look like 255-abs(ip1-ip2)

    I just don't know how to pull the proper numbers without splitting everything into columns

    Some additional examples:

    172.17.1.200 and 172.18.1.190 would yield 255.254.255.0
    172.18.1.100 and 172.18.3.100 would yield 255.255.253.0
    Last edited by ammauric; 04-13-2011 at 09:06 AM.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Working with multiple delimiters in a string

    try this i think its right
    ="255."&255-(TRIM(MID(SUBSTITUTE(B1,".",REPT(" ",50)),51,20))-TRIM(MID(SUBSTITUTE(A1,".",REPT(" ",50)),51,20)))&"."&255-(TRIM(MID(SUBSTITUTE(B1,".",REPT(" ",50)),100,30))-TRIM(MID(SUBSTITUTE(A1,".",REPT(" ",50)),100,30)))&".0"

  5. #5
    Registered User
    Join Date
    04-08-2011
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Working with multiple delimiters in a string

    Works beautifully, except when A1 has a number larger than B1, but it was a quick fix with ABS.

    Although I don't think I'll ever need it or run into it, is there a reason the first set was left alone?

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Working with multiple delimiters in a string

    just coz i didnt think you'd have a mask starting less than 255

  7. #7
    Registered User
    Join Date
    04-08-2011
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Working with multiple delimiters in a string

    Yeah, that's understandable, thanks for the great work!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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