+ Reply to Thread
Results 1 to 8 of 8

Retrieving cells that contains two values from a list

  1. #1
    Registered User
    Join Date
    04-25-2017
    Location
    Sweden
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 2002
    Posts
    33

    Retrieving cells that contains two values from a list

    Hello,

    I've made an excel file to illustrate what im trying to get.

    In the file I have two columns, Accounts and Type. Some of these accounts are both A and B and some are only A or B.

    In column C, I would like to create a list of the accounts that contain both A and B.

    Is that possible to do?

    /Peter
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Retrieving cells that contains two values from a list

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,782

    Re: Retrieving cells that contains two values from a list

    C2=UNIQUE(FILTER(FILTER(A2:A29,B2:B29="a"),ISNUMBER(MATCH(FILTER(A2:A29,B2:B29="a"),FILTER(A2:A29,B2:B29="b"),0))))

  4. #4
    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,054

    Re: Retrieving cells that contains two values from a list

    or (if you have moved on from Version 2202):

    =LET(A,A2:A29,B,B2:B29,UNIQUE(FILTER(A,BYROW(COUNTIFS(A,A,B,{"A","B"}),LAMBDA(x,SUM(x)))>1)))
    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

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Retrieving cells that contains two values from a list

    @Glenn: I think there may be a flaw in your logic. If, for example, you change all the As against Stockholm to Cs, Stockholm is still included in the list.
    Attached Files Attached Files

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Retrieving cells that contains two values from a list

    with Power Query

    Account List
    Tokyo B,A
    Stockholm A,B
    Berlin A,B
    Helsinki B,A
    Munich B,A


    Please Login or Register  to view this content.

  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
    44,054

    Re: Retrieving cells that contains two values from a list

    It's not my day, is it???

    Fixable with:
    =LET(A,A2:A29,B,B2:B29,UNIQUE(FILTER(A,BYROW(COUNTIFS(A,A,B,{"A","B"}),LAMBDA(x,IFERROR(SUM(1/(1/x)),0)))>1)))
    Last edited by Glenn Kennedy; 03-18-2023 at 10:51 AM.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Retrieving cells that contains two values from a list

    Yay, mended! I don't understand it, but it works. I tidied my formula up, but it's still the longest solution. The advantage of it is, I understand it!

+ 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] Retrieving missing values from a list
    By Peter Niklas in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-17-2020, 06:19 AM
  2. [SOLVED] Retrieving cells based on drop down list
    By drew250 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-13-2014, 07:23 PM
  3. Replies: 4
    Last Post: 07-16-2012, 06:22 AM
  4. Retrieving Unique Values From A List - TIP
    By ddwebb in forum Excel Formulas & Functions
    Replies: 41
    Last Post: 09-06-2005, 09:05 PM
  5. Replies: 0
    Last Post: 08-28-2005, 11:30 AM
  6. Replies: 1
    Last Post: 08-28-2005, 11:28 AM
  7. Retrieving the Minimal / Maximal Values from a Filtered List
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-25-2005, 02:55 AM

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