+ Reply to Thread
Results 1 to 8 of 8

Function to match contents of comments ?

  1. #1
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Function to match contents of comments ?

    Hi

    please have a look at the attached workbook.

    On sheet1, I have numbers and names. These names are also contained in Comments on sheet2, and i would like a function in Column M that matches the numbers with the names in the comments. Cell M1 I have manually filled for demonstration purposes.

    Can this be done with a function or is this a VBA task?

    Thank you muchly!
    Attached Files Attached Files

  2. #2
    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: Function to match contents of comments ?

    Copy and paste this formula in M1 and drag it down


    =IF(ISERROR(VLOOKUP("*"&A1&"*",CHOOSE({1,2},Sheet1!$C$1:$C$88,Sheet1!$B$1:$B$88),2,0)),"Not Found",VLOOKUP("*"&A1&"*",CHOOSE({1,2},Sheet1!$C$1:$C$88,Sheet1!$B$1:$B$88),2,0))
    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

  3. #3
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Function to match contents of comments ?

    mmmm. if i use that formula, it gives me "not found" in all cells

  4. #4
    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: Function to match contents of comments ?

    Please see attached file
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Function to match contents of comments ?

    I see. Is it not possible for the formula to look in the comments for a match on sheet1 ? For example "Andreas Vogel" has number 012222002736, but it says "not found" on sheet2.

  6. #6
    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: Function to match contents of comments ?

    Unfortunately formulas can't read comments. The names and phone numbers are pulled from the sheet1. So the only way to look up is by the last name. However, there are few of them have a letter before the last name and some are not present on sheet1 that is way they are not found.

    here are modified formulas:

    for Phone number

    =IF(ISERROR(VLOOKUP("*"&IF(ISERROR(FIND(" ",A1)),A1,REPLACE(A1,1,FIND(" ",A1),""))&"*",CHOOSE({1,2},Sheet1!$C$1:$C$88,Sheet1!$B$1:$B$88),2,0)),"Not Found",VLOOKUP("*"&IF(ISERROR(FIND(" ",A1)),A1,REPLACE(A1,1,FIND(" ",A1),""))&"*",CHOOSE({1,2},Sheet1!$C$1:$C$88,Sheet1!$B$1:$B$88),2,0))

    for Names

    =IF(ISERROR(VLOOKUP("*"&IF(ISERROR(FIND(" ",A1)),A1,REPLACE(A1,1,FIND(" ",A1),""))&"*",CHOOSE({1,2},Sheet1!$C$1:$C$88,Sheet1!$B$1:$B$88),1,0)),"Not Found",VLOOKUP("*"&IF(ISERROR(FIND(" ",A1)),A1,REPLACE(A1,1,FIND(" ",A1),""))&"*",CHOOSE({1,2},Sheet1!$C$1:$C$88,Sheet1!$B$1:$B$88),1,0))

    The only other way to get data from comments is Vba

    You can use this UDF from chandoo.org

    Please Login or Register  to view this content.
    Then use formula:
    =getComment(A1)
    Last edited by AlKey; 02-27-2014 at 08:14 PM.

  7. #7
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Function to match contents of comments ?

    Thank you very much. I guess I will have to enter the exact name in the cell and not just in the comment for the formular to match it correctly.

  8. #8
    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: Function to match contents of comments ?

    You're welcome. Don't forget to thank those who helped by clicking on Add Reputation * and please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

+ 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. Cell contents to comments
    By phil2006 in forum Excel General
    Replies: 8
    Last Post: 02-07-2014, 02:03 PM
  2. Replies: 6
    Last Post: 12-07-2012, 05:38 PM
  3. Excel 2007 : Listing comments and cell contents
    By MSP in forum Excel General
    Replies: 2
    Last Post: 12-30-2010, 11:53 AM
  4. Replies: 1
    Last Post: 06-27-2006, 12:10 PM
  5. [SOLVED] Contents to Comments, Cumulative
    By Lambs in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-02-2006, 04:20 PM

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