Closed Thread
Results 1 to 18 of 18

Use vlookup to lookup cell comments

  1. #1
    Registered User
    Join Date
    08-29-2010
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    9

    Use vlookup to lookup cell comments

    Hi there

    Ive been using vlookup for some time now and have just come across a wall that i cannot seem to overcome.

    I work with large spreasheets with a huge amount of information on them, and hence i use vlookup to compile reports etc etc. Now my latest report requires that in combination with a vlookup to a multitude of information i require a vlookup funtion that can paste in a cell the "inserted comments" of the referenced cell, but not the data of the cell, on another sheet in the same workbook.

    I have tried searching the forums all over the web but cannot seem to find an answer to this. VBA is not my forte and so i understand very little of it, so was wondering if there was not a simpler way to do this

    Any help in this regard would be appreciated

    Clint

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Use vlookup tp lookup cell comments

    Welcome to the forum.

    I moved your thread to one of the question forums. Please take a few minutes to read the forum rulesbefore posting again.

    You cannot access another cell's comment via worksheet functions; it would require VBA. Suggest you move the comments to cells in another column of the lookup table.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Use vlookup tp lookup cell comments

    Hi Clint

    There is a way which probably fits what you want. The attached file uses a function from Dana DeLouis
    HTML Code: 
    This coupled with the uses of ADDRESS and VLOOKUP should give you what you need. There is however a caveat, it is a volatile function and that can create problems due to recalculation, I would advise reading the comments from David McRitchie here
    HTML Code: 
    Regards

    Jeff
    Attached Files Attached Files
    Last edited by solnajeff; 08-29-2010 at 12:09 PM.

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Use vlookup tp lookup cell comments

    My apologies, solnajeffs' solution is better than my offering.

    Post content removed.
    Last edited by Marcol; 08-29-2010 at 01:49 PM.

  5. #5
    Registered User
    Join Date
    08-29-2010
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Use vlookup tp lookup cell comments

    Thanks, But thread was removed for some reason.

  6. #6
    Registered User
    Join Date
    08-29-2010
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Use vlookup tp lookup cell comments

    Thanks

    I had a look at this, tried it, and it doesnt work for me

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Use vlookup tp lookup cell comments

    Works for me.

    Can you post a sample workbook with the sheets you are using and including your VLOOKUP formula?

  8. #8
    Registered User
    Join Date
    08-29-2010
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Use vlookup tp lookup cell comments

    will do so shortly
    Last edited by shg; 08-30-2010 at 08:20 AM. Reason: deleted quote

  9. #9
    Registered User
    Join Date
    08-29-2010
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Use vlookup tp lookup cell comments

    OK I have uploaded a simple condensed version of my actual file which im working with,

    What i need to do is this:

    Vlookup the comments from sheet "AG_Final" Column L Only with the corresponding lookup data from sheet "Trust Acc Deposits" and place the comments in column I

    The named range in the first spreadsheet is Named SORTAREA

    As you will see from the example, some comments have multiple rows which all need to be displayed in a single cell.

    The vlookup formula at this stage is =VLOOKUP(B4,SORTAREA,12,0) but this returns the data in the cell, and not the comment only.

    Looking forward to your assistance

    Clint
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Use vlookup to lookup cell comments

    Hi Clint

    Sorry I could not reply earlier. There was an error in the original example and I have corrected it so that it works with your file.

    It should have used the MATCH function rather than VLOOKUP as MATCH returns the row number required and also the ADDRESS function for your example needs the Sheet name as the formula is located on a different page.

    To summarize, the Match function combined with the Address and Indirect functions give you the location of the cell containing a comment. The UDF MyComment will display the comment from the target cell, the UDF MUST be present in a Module in the VBE, you can see it clicking ALT+F11.

    Your revised file is attached.

    Regards

    Jeff
    Attached Files Attached Files

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Use vlookup to lookup cell comments

    Snap solnajeff

    I have added the option to retain or trim the comment leader
    Attached Files Attached Files
    Last edited by Marcol; 08-30-2010 at 11:37 AM. Reason: Removed redundant code from workbook
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  12. #12
    Registered User
    Join Date
    08-29-2010
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Use vlookup to lookup cell comments

    Maybe im being stupid here, but when i open the revised spreadhseet u sent i get an error in the cell where you pasted the formula =mycomment(INDIRECT(ADDRESS(MATCH(B4,'AG_Final List'!A:A,0),12,4, TRUE, "AG_Final List")))

    Which is #NAME?

    Whem i copy the code and formula to my spreadsheet the same error message displays.

    Clint

  13. #13
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Use vlookup to lookup cell comments

    Hi Clint

    The most likely reason is that you have macros disabled, because there is a UDF you need to have macros enabled, also you need to copy the function from the VBE in the test file to your working sheet.

    Regards

    Jeff

  14. #14
    Registered User
    Join Date
    08-29-2010
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Use vlookup to lookup cell comments

    Hi jeff

    I did copy the code across and enabled macros but the same error occurs, will try again and get back to you.

    Sorry for being a pain

    Clint

  15. #15
    Registered User
    Join Date
    08-29-2010
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Use vlookup to lookup cell comments

    Hi Jeff,

    No change in the error code. I have uploaded my form for you to see, amybe point me where im going wrong.

    Thanks

    Clint
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Use vlookup to lookup cell comments

    Hi Clint

    The problem is the location of the UDF, it needs to be in a Module not on the sheet, Go to the VBE and in the Project Panel right click in the area used by your file and select Insert|Module, then copy the UDF into the module, delete the code from the sheet, save and restart and it will work okay, at least it does for me.

    Regards

    Jeff

  17. #17
    Registered User
    Join Date
    12-03-2011
    Location
    saudi arabia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: required cell value with cell comment

    Dear

    please find attached file.

    i want cell value along with cell's comment
    Attached Files Attached Files

  18. #18
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Use vlookup to lookup cell comments

    Please do not hijack others' threads.

Closed Thread

Thread Information

Users Browsing this Thread

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

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