+ Reply to Thread
Results 1 to 6 of 6

Lookup IP addresses and map subnet against it

  1. #1
    Registered User
    Join Date
    03-02-2022
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Office 365
    Posts
    6

    Question Lookup IP addresses and map subnet against it

    I have a file at work that has two sheets; "Subnet Info" & "Machine Info".

    The Subnet Info sheet has the subnet details, like the subnet network address in one column (let's say A e.g. A2 = 10.10.0.0) & the mask in the other column (let's say B e.g. B = 16 where 16 means /16). Please see the image below.

    Clipboard Picture (2022.03.02 11.32.22).png

    The Machine Info sheet has the IP address of the servers in the environment along with some other information. What I want to achieve is that in the column (let's say D, marked in red in the picture), we look up the machine IP address and understand which IP range it falls under based on the subnet from the Subnet Info sheet and return that in Column D.

    Clipboard Picture (2022.03.02 11.34.04).png

    I know this is a forum to get help and not a job request, but I don't know where to start. Can this be done with Formula or VBA macro better? If yes can someone point me in the right direction? If someone has written something similar and can share that, it will be highly appreciated.

    Please find the sample file attached.

    P.S: I have data in the range of 200+ subnets and 2000+ in the machine info sheet.
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Lookup IP addresses and map subnet against it

    If I have understood you correctly, use:


    =IFERROR(VLOOKUP(A2,'Subnet Info'!A:B,2,FALSE),"None")

    However there were NO matching values!! So, I added one.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    03-02-2022
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Lookup IP addresses and map subnet against it

    If the IP could be looked up then nothing would be better. However, the subnet lookup is different. Let me elaborate.

    10.10.0.0 /16 entails IP ranges 10.10.0.0 - 10.10.255.255 for e.g. 10.10.0.1, 10.10.0.2, 10.10.2.1, 10.10.2.2, 10.10.100.100, 10.10.200.200 all fall within this range. So we have to calculate and understand the range for each item in subnet info. Then understand the IPs that fall within this range.

    10.10.100.100
    10.10.1.5
    10.10.20.30
    10.10.120.121

    All are part of 10.10.0.0 (/16) subnet.


    10.160.32.150 - belongs to 10.160.32.0 /20 as the 10.160.32.0/20 covers ranges from 10.160.32.0 to 10.160.47.255
    10.160.32.100 - belongs to 10.160.32.0 /20 it falls in the range mentioned above.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Lookup IP addresses and map subnet against it

    Hehehe. Ok. I can drive a car... but I've no idea how the engine works. Same with Excel & computers. Out for an hour or so.

  5. #5
    Registered User
    Join Date
    03-02-2022
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Lookup IP addresses and map subnet against it

    Quote Originally Posted by Glenn Kennedy View Post
    Hehehe. Ok. I can drive a car... but I've no idea how the engine works. Same with Excel & computers. Out for an hour or so.
    hahaha true that. I understood immediately that you are not aware of the IP subnetting but thank you so much for trying to help out. Appreciate it.

  6. #6
    Registered User
    Join Date
    03-02-2022
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Lookup IP addresses and map subnet against it

    Bump. Anyone implemented something similar. Any & all help will be appreciated.

+ 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. LOOKUP function to return email addresses
    By shakra888 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-20-2021, 03:49 AM
  2. Verify a list of addresses with the USPS zip code lookup tool
    By GJL65 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-15-2021, 08:52 PM
  3. Lookup IP address in Subnet, return location
    By christy4370 in forum Excel General
    Replies: 5
    Last Post: 04-13-2016, 05:18 AM
  4. LOOKUP IF - email addresses Country and Company
    By Texastom123 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-11-2014, 12:38 PM
  5. [SOLVED] Nested If revolving around IP addresses & subnet masks
    By Uthar in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-19-2013, 12:49 PM
  6. Need to take an IP Subnet Range and Output Subnet Mask
    By Markh7999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2013, 08:53 PM
  7. Conditional lookup and moving of addresses
    By sabbur in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-25-2009, 02:14 PM

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