+ Reply to Thread
Results 1 to 7 of 7

Need help with a forumla for mapping IP addresses to Private or Public defined spaces

  1. #1
    Registered User
    Join Date
    03-20-2013
    Location
    NA, USA
    MS-Off Ver
    Excel 2010
    Posts
    41

    Need help with a forumla for mapping IP addresses to Private or Public defined spaces

    Hello,

    I need help with a formula. First to explain what I am doing. I have a macro that pulls specific data from a CSV, then I copy that extract to my master excel doc (setup by year), so I can put the data into pivot tables and charts. This is used to create "management" style reports.

    This data has IP addresses in it. Both internal and external. Trying to find a formula that will look at Cell A, where the IP address is and input either External or Internal into column AA, based on the number.

    Internal would be numbers between 10.0.0.0 and 10.255.255.255, 172.16.0.0 and 172.31.255.255, and 192.168.0.0 and 192.168.255.255. Anything not in those three ranges would show as External.

    Thanks in advance.
    Last edited by robiton; 01-02-2014 at 08:33 AM.

  2. #2
    Registered User
    Join Date
    11-20-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: Need help with a forumla

    Here's a start:

    For example, list your start IP's range (Your internal network IPs) in Cells D1, D2, D3
    Highlight those cells and name them something like IPSTART

    In Cells E1, E2, E3 list your IP end range.
    Highlight those cells and name them something like IPEND

    IN Cell A1, list the IP to be checked. In B1, do this =IF(AND(A1>=INTSTART,A1<=INTEND),"Internal","External")

    Now, the issue you have is you will probably need to convert those IP's to something that can be recognizebale / sortable.

    I googled and came up with this that may be a help: http://dmcritchie.mvps.org/excel/sorttcp.htm
    Looking at that, I'd probably convert to the regular number range (i.e., 122.123.124.125 = 2054913149)
    Last edited by kspeese; 12-31-2013 at 02:51 PM.

  3. #3
    Registered User
    Join Date
    03-20-2013
    Location
    NA, USA
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Need help with a forumla

    Thank you. This helps some, though I was trying not to have to break the source data into separate cells. Some times the extract is 5000+ lines in size.

    Was hoping there would be a formula that could do a range match. ie something like IF A1 <192.168.0.0 but less than 192.168.255.255 then B1 = Internal.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Need help with a forumla

    Thanks for the title change
    Last edited by FDibbins; 01-03-2014 at 04:35 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

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

    Re: Need help with a forumla

    you can convert ip to its equivalent decimal then look up the range, i have a nice formula ready for you but you need to change your thread title first or else i'll get banned!
    Last edited by martindwilson; 01-01-2014 at 07:33 AM.
    "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

  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: Need help with a forumla for mapping IP addresses to Private or Public defined spaces

    this should work for you
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-20-2013
    Location
    NA, USA
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Need help with a forumla for mapping IP addresses to Private or Public defined spaces

    Thank you, I will give this a shot.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Forumla
    By FSt1 in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-06-2005, 07:05 PM
  2. Forumla
    By Don in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  3. Forumla
    By Don in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  4. [SOLVED] Forumla
    By Don in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  5. Replacing a cell's forumla with the forumla's results?
    By Mooncalf in forum Excel General
    Replies: 2
    Last Post: 01-04-2005, 12:35 AM

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