+ Reply to Thread
Results 1 to 12 of 12

Partial IP Address Range Match Between 2 Columns

  1. #1
    Registered User
    Join Date
    12-06-2007
    Posts
    32

    Partial IP Address Range Match Between 2 Columns

    Hello,

    I have a list of banned IP addresses in column A named "PK" listed as 3 quadrant addresses (123.456.789 or 1.25.289)
    I have a list of all my message board IP addresses in column B named "IP" listed as 4 quadrant addresses (123.456.789.101 or 1.1.0.5)

    How can I make a formula that compares each IP address in column B to each IP address in column A?

    Even better, how can I have any matches copied to column C?

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Partial IP Address Range Match Between 2 Columns

    Do you have an example workbook with some sample data in?

  3. #3
    Registered User
    Join Date
    12-06-2007
    Posts
    32

    Re: Partial IP Address Range Match Between 2 Columns

    Sure, thank you. Hopefully, I have attached the file correctly.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Partial IP Address Range Match Between 2 Columns

    Yup, it's fine, thanks.

    In cell C2 try this:

    =IF(ROW(A1)>SUMPRODUCT(--(ISNUMBER(MATCH(LEFT(IP,FIND("~",SUBSTITUTE(IP,".","~",3))-1),PK,0)))),"",INDEX(B:B,SMALL(IF(ISNUMBER(MATCH(LEFT(IP,FIND("~",SUBSTITUTE(IP,".","~",3))-1),PK,0)),ROW(IP)),ROW(A1))))

    This is an array formula, so must be entered with Ctrl-Shift-Enter, not just Enter.

    Once entered copied down as many rows as you feel you need.

    Note that the data in your sample file doesn't appear to include any matches.

  5. #5
    Registered User
    Join Date
    12-06-2007
    Posts
    32

    Re: Partial IP Address Range Match Between 2 Columns

    I entered that formula and did not get any matches. Then I changed the data in cell A2 to match the data in B2 except for the last quadrant and still did not get a match...

  6. #6
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Partial IP Address Range Match Between 2 Columns

    Did you enter the formula with Ctrl-Shift-Enter? If so it should appear on the formula line encased in curly brackets { }

  7. #7
    Registered User
    Join Date
    12-06-2007
    Posts
    32

    Re: Partial IP Address Range Match Between 2 Columns

    The data entered in the cell, but with no curly brackets show. I tried 10 times - am I doing this correctly?

    1. highlight the range of cells where I want my formula to appear;
    2. enter the formula in the edit bar;
    3. press ctrl+shift+enter (simultaneously)

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

    Re: Partial IP Address Range Match Between 2 Columns

    there are no matches for any string in col a with the first 3 quadrants of col b
    give an example of one you expect to find
    "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

  9. #9
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Partial IP Address Range Match Between 2 Columns

    At step 1 try:

    1. Highlight a single cell where you want the formula to appear.

    Then after that it should work.

  10. #10
    Registered User
    Join Date
    12-06-2007
    Posts
    32

    Re: Partial IP Address Range Match Between 2 Columns

    That also did not work for me. If I directly enter the formula by pasting it into the cell, it shows in the edit bar, but the cell remains blank. If I enter the formula into the edit bar then use CSE, the formula shows, but is not in curly brackets.

    @martindwilson: if I take any value in the A column and edit it to match the first 3 quadrants of the B column (in the same row, in this case just for ease) I would expect a match, wouldn't I?

  11. #11
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Partial IP Address Range Match Between 2 Columns

    Hmmm, not really sure what to advise.

    I've attached my updated version of your sample sheet, with the formula and a couple of matches in, but I don't know why it's not working for you.
    Attached Files Attached Files

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

    Re: Partial IP Address Range Match Between 2 Columns

    use advanced filter see attached i changed 2 to match
    Attached Files Attached Files

+ 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