+ Reply to Thread
Results 1 to 14 of 14

Extract some data from a string

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Extract some data from a string

    Hello, so following on from:

    http://www.excelforum.com/excel-gene...some-data.html

    I have some MAC addresses listed as the result of a formula:

    Please Login or Register  to view this content.
    Displayed value = b499.ba7a.72a1

    On another sheet I have many rows of data, this is an example of a row:

    10.188.104.180 0017a4773c50 stratsoln-uat-vr/eth2/1.466 VLD 382 0 0 199

    There is a 1-1 mapping of a MAC address to an IP address.

    Some have spaces in front of the IP, some don't

    As you can see, the formats of the MAC address are different, but last 4 digits of the MAC should be unique.

    I would like to automate searching for 72a1 and discovering which IP it is using, without having to manually Ctrl+F. Ideally it would also place that IP value in the column one to the right of the MAC.

    Hope that makes sense

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract some data from a string

    Hi,

    Please upload the workbook with a representative sample of data and manually add the results you expect to see clearly explaining which are the result cells. It's always easier if we can see in context.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-28-2014
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Extract some data from a string

    Upload attached
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    01-28-2014
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Extract some data from a string

    Any ideas?

  5. #5
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Extract some data from a string

    In your file example sheet2 cell B4 contains

    10.188.104.39 0050569434cb stratsoln-uat-vr/eth2/1.463 VLD 1199 0 0 39

    The string to match is 0050569434cb
    The string to return is 10.188.104.39

    Is the item to return always the 1st string in the cell?
    Is the item to match always the 2nd string in the cell?
    If a response has helped then please consider rating it by clicking on *Add Reputation below the post
    When your issue has been resolved don't forget to mark the thread SOLVED (click Thread Tools at top of thread)

  6. #6
    Registered User
    Join Date
    01-28-2014
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Extract some data from a string

    ..Correct..

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract some data from a string

    Hi,

    Perhaps

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-28-2014
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Extract some data from a string

    It returned the wrong IP - can I ask why B1:B10?

    I think because of the full stops in Sheet1 in the values may throw it off?

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract some data from a string

    B1:B10 was merely an example. You would need to adjust the 1:10 range to cover the maximum likely number of rows, or better still use a dynamic range name so that you can forget about how many rows need to be covered.

    Upload a workbook with more examples of your data. A single example often isn't enough, particularly if it's not representative of all the permutations of record layouts.

  10. #10
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Extract some data from a string

    To correct for the full stops
    amend the formula and replace both E8 with SUBSTITUTE(E8,".","")

    A lazy (but usually effective) way to make the range dynamic is to replace B1:B10 with B:B
    Last edited by Kevin#; 05-20-2016 at 09:11 AM.

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Extract some data from a string

    Perhaps this will help you. Enter in F8 and fill down as required. If required, change the B:B to the range required.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    C
    D
    E
    F
    7
    IP Address (expected value displayed, can it be extracted from sheet 2?)
    8
    1302 0050.5694.34cb dynamic ip,ipx,assigned,other GigabitEthernet1/4
    1302
    0050.5694.34cb
    10.188.104.39
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  12. #12
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract some data from a string

    I have replaced your long formula on Sheet1 with a shorter version
    Enter in D8 and pull formula to E8
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    now for the lookup use this formula in F8 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v B C D E F
    5
    6 Formula:
    7 IP Address (expected value displayed, can it be extracted from sheet 2?)
    8 1302 0050.5694.34cb dynamic ip,ipx,assigned,other GigabitEthernet1/4 1302 0050569434cb 10.188.104.34
    9
    Last edited by AlKey; 05-20-2016 at 11:58 AM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  13. #13
    Registered User
    Join Date
    01-28-2014
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Extract some data from a string

    Yep, working perfectly! Thanks

  14. #14
    Registered User
    Join Date
    01-28-2014
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Extract some data from a string

    Ah, just wondering something... is it possible to replicate exactly the same function but with data in the following format:

    ? (10.188.229.105) at 00:50:56:94:14:2B [ether] on eth1-01.3808

    Might be simpler to covert the data above into the old format, i.e.:

    1618 10.188.104.72 00505694639b eth2/1.148 0010dbff6150 1304 0 0x2 0

+ 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. Extract name from a string, not constant data
    By seash in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-11-2016, 12:49 PM
  2. [SOLVED] Extract data from text string
    By cmb80 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-12-2014, 11:53 AM
  3. [SOLVED] Extract data from text string
    By cmb80 in forum Excel General
    Replies: 14
    Last Post: 07-16-2014, 11:29 AM
  4. Extract data from text string
    By bigband1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2011, 04:55 AM
  5. Extract Data from a string
    By dcaraher in forum Excel General
    Replies: 13
    Last Post: 12-15-2010, 10:13 AM
  6. How to extract data from a string?
    By bunster in forum Excel General
    Replies: 4
    Last Post: 04-20-2009, 06:17 AM
  7. Extract data from String
    By SL in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-10-2006, 08:40 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