+ Reply to Thread
Results 1 to 15 of 15

Finding all values

  1. #1
    Forum Contributor
    Join Date
    02-16-2016
    Location
    england
    MS-Off Ver
    11
    Posts
    115

    Finding all values

    Hi all, I am wondering if it is possible to do a vlookup and instead of the result being the first value found that is returned, is there a way to return all the vallues associated to the look up? I have put an example on the atatchments (item 1).

    Thanks,

    Dean
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Finding all values

    Just to be clear, is it a VBA solution you are after?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    02-16-2016
    Location
    england
    MS-Off Ver
    11
    Posts
    115

    Re: Finding all values

    What is VBA?

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Finding all values

    Visual Basic for Applications (macros). I asked because I know that often people post in this section when in fact they are looking for a formula, not a macro.

  5. #5
    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,023

    Re: Finding all values

    VBA = Visual Basic for Applications

    Basically, you need a macro to do this. The code for the macro (a User-Defined Function, called concatAll) has been mpasted into a module in your sheet.

    Please Login or Register  to view this content.
    Right click on the sheet name, then VIEW CODE then MODULE 1 to see it in place.

    The formula then needed is:

    =concatall(IF($C$5:$C$12=C15,$D$5:$D$12,""),CHAR(10))

    This ia an array formula:

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...

    The CHAR(10) bit starts a new line after every result.

    Enable macros on opening this sheet.
    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

  6. #6
    Forum Contributor
    Join Date
    02-16-2016
    Location
    england
    MS-Off Ver
    11
    Posts
    115

    Re: Finding all values

    Sorry didnt see this was a macro forum, i'll post to the correct area

  7. #7
    Forum Contributor
    Join Date
    02-16-2016
    Location
    england
    MS-Off Ver
    11
    Posts
    115

    Re: Finding all values

    Thanks Glenn,

    this is a bit out of my abilities I think, thanks anyway.

    Dean

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Finding all values

    No need to start again - I have moved the thread.

  9. #9
    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,023

    Re: Finding all values

    If you want the answers in the same cell.... you have no choice.

  10. #10
    Forum Contributor
    Join Date
    02-16-2016
    Location
    england
    MS-Off Ver
    11
    Posts
    115

    Re: Finding all values

    Glenn,

    have i got this correct, "paste all the code into the code sheet and return to the excel sheet"

    Paste formula

    CTRL+SHIFT+ENTER


    ???

    Dean

  11. #11
    Forum Contributor
    Join Date
    02-16-2016
    Location
    england
    MS-Off Ver
    11
    Posts
    115

    Re: Finding all values

    Great got it - Thanks loads

  12. #12
    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,023

    Re: Finding all values

    If you are wanting to copy this into your real sheet...

    right click ion sheet name, VIEW code/Insert module

    copy in the code, save as macro enabled. use formula, with the corrected ranges, enter with CTRL-SHIFT-ENTEr and not just enter.

  13. #13
    Forum Contributor
    Join Date
    09-18-2014
    Location
    England
    MS-Off Ver
    2003/2010/365
    Posts
    119

    Re: Finding all values

    Hi Glenn,

    Thanks for posting concatAll - Not come across it before!

    The CHAR(10) bit starts a new line after every result.
    This bit isn't working for me - perhaps a version issue?

    Are you able to change the new line to ", ", after each result?

    Thanks in advance

    (Apologises for poaching thread Deanblew)

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Finding all values

    SharpL - unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member - start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    Nobody should respond to SharpL's query in this thread, please. Thanks!

  15. #15
    Forum Contributor
    Join Date
    09-18-2014
    Location
    England
    MS-Off Ver
    2003/2010/365
    Posts
    119

    Re: Finding all values

    Apologises AliGW.

+ 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. Code for Finding Highest values, Lookup,Offset Values
    By structo in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-06-2016, 01:26 PM
  2. Replies: 6
    Last Post: 08-09-2016, 10:50 AM
  3. FInding Max stress values until an instant strain values
    By mecheng85 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-28-2015, 02:07 PM
  4. [SOLVED] the code is finding repeated values but i need to search values from E column to D
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-14-2014, 01:33 AM
  5. [SOLVED] Finding Sum of Unique Values for Duplicate Values
    By LegoLand in forum Excel General
    Replies: 13
    Last Post: 03-21-2014, 06:49 PM
  6. Finding Values Difference when values are ever changing
    By Gamerxx13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2013, 08:23 PM
  7. [SOLVED] Finding values within text and substituting with alternate values.
    By Bhupinder Rayat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2006, 09:45 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