+ Reply to Thread
Results 1 to 15 of 15

A formula which results in a list of names based on specific criteria

  1. #1
    Registered User
    Join Date
    03-13-2014
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2007
    Posts
    59

    A formula which results in a list of names based on specific criteria

    Hi all!

    How can we have a list as a result in excel?
    In order to help you understand the issue I made the attached file. In the sheet "data" you can see a list of names where we have results for 2 KPIs (KPI1 & KPI2, values available: T, MT, ML, B).
    In the sheet "matrix" we have the matrix of these 2 KPIs and I need a formula in order the cells C5:F8 to be filled with the names matched. For example in cell C5 I need the list of names (of sheet "data") that have T in both KPIs etc.

    Is this something easy to do?

    Any help will be appreciated
    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
    43,976

    Re: A formula which results in a list of names based on specific criteria

    You can't get it in exactly the format uou want without a bit of VBA.

    Please Login or Register  to view this content.
    Here's the code that needs to be inserted in a module (right click sheet name, view code, INSERT, MODULE:

    The formula (array entered) is
    =concatall(IF(data!$B$3:$B$64=matrix!$B5,IF(data!$C$3:$C$64=matrix!C$4,data!$A$3:$A$64,""),""),", ")

    where the big bold bit at the end defines the separator between each answer.

    Array Formulae are a little different from ordinary formulas 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 braces { } appear around the outside of your formula. If you do not 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 braces yourself - it won't work...

    DON'T FORGET - open this file as macro enabled...
    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
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,145

    Re: A formula which results in a list of names based on specific criteria

    Another VBA solution

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-13-2014
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: A formula which results in a list of names based on specific criteria

    Ouao! This is great! Thank you!

    To do this in another file I need to change something in the code or the code is to define the formula concatall only?

  5. #5
    Registered User
    Join Date
    03-13-2014
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: A formula which results in a list of names based on specific criteria

    John thank you too!
    I have the same question for you... Change the code is needed for another file where I have more names for instance?

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,145

    Re: A formula which results in a list of names based on specific criteria

    Yes you will need to change code: If you post file with your complete list then I will amend code.

    If you keep the "MATRIX" file in the same rows/columns but are just extending row 4 and column B then you need to change:

    Dim matrix(1 To 4, 1 To 4) As String ..... from 4 to number of items

    ws2.Range("c4:f4") extend to maximum column (you could default to Z for example)

    ws2.Range("c5:f8") to new range of MATRIX

  7. #7
    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
    43,976

    Re: A formula which results in a list of names based on specific criteria

    In my case, no. As long as the code is in a module, it should be fine. The code doesn't need to be adjusted.

  8. #8
    Registered User
    Join Date
    03-13-2014
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: A formula which results in a list of names based on specific criteria

    The matrix will be the same. In the sheet data I may have changes, since agents come and go all the time and the number of names will be different.
    I added names till agent71 and press run and it worked fine

  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
    43,976

    Re: A formula which results in a list of names based on specific criteria

    Glad to have helped. thanks for the Rep.

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,145

    Re: A formula which results in a list of names based on specific criteria

    If you are only adding/deleting agents, then no change is required.

  11. #11
    Registered User
    Join Date
    03-13-2014
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: A formula which results in a list of names based on specific criteria

    Thank you both for the help! I really appreciated!

  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
    43,976

    Re: A formula which results in a list of names based on specific criteria

    But of course the FORMULA will need to be adjusted...

    =concatall(IF(data!$B$3:$B$64=matrix!$B5,IF(data!$C$3:$C$64=matrix!C$4,data!$A$3:$A$64,""),""),", ")

  13. #13
    Registered User
    Join Date
    03-13-2014
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: A formula which results in a list of names based on specific criteria

    Yes. that I figured out... The vba part is the black box for me..
    Thanks again Glenn!

  14. #14
    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
    43,976

    Re: A formula which results in a list of names based on specific criteria

    Just checking... some people (me included)... use the term "code" (mistakenly) when they mean "formula"...

  15. #15
    Registered User
    Join Date
    03-13-2014
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: A formula which results in a list of names based on specific criteria

    And how they say the code?

+ 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. [SOLVED] Need to return a specific list of names based on age
    By mir4ge in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-29-2016, 04:13 PM
  2. [SOLVED] excel formula return dynamic list of names based on two criteria
    By deanusa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-07-2015, 02:23 PM
  3. Filtering a list of Names from Worksheet1 onto Worksheet 2 based on specific criteria
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2014, 05:19 AM
  4. Sort, calculate and paste results based on specific criteria
    By macrorookie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2014, 11:28 PM
  5. List Results Based on Multiple Criteria
    By scottcnichols in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-23-2013, 12:30 PM
  6. Replies: 2
    Last Post: 11-20-2007, 04:42 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