+ Reply to Thread
Results 1 to 30 of 30

Sort unique from multiple columns if criteria met

  1. #1
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Sort unique from multiple columns if criteria met

    I have several columns which I'm trying to extract unique values from if row meets a criteria.

    Providers by name are in columns A, C, E, G, I and K.
    Services they provide are in columns B, D, F, H, J, L, N, O, P, Q, R, S, T, U, V and W.

    When a provider name is selected in "A12" and it matches agencies in provider name columns, I want to filter unique services from all service columns. My formula in "Y3" shows an error but I don't know why......
    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,943

    Re: Sort unique from multiple columns if criteria met

    Please mock up the results you are expecting. I cannot work out from the formula what you are expecting it to return.
    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 Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Sort unique from multiple columns if criteria met

    try

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Sort unique from multiple columns if criteria met

    Another option
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    This did not filter the services in columns N thru W

  6. #6
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    This also did not filter the services in columns N thru W

  7. #7
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    See attached AliG. I changed the filtered Agency to "GEORGIA MOUNTAINSCSB".

    My desired output is in column "AC".....

  8. #8
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Sort unique from multiple columns if criteria met

    Try this,

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    I'm going to simplify my ask:

    If "A3" occurs in ProviderName1 to ProviderName3, values in same row of columns Service Group Name 1 thru Nursing Services should be filtered/sorted/unique.

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Sort unique from multiple columns if criteria met

    Have you tried the formula windknife suggested? It appears to do what you asked for.

  11. #11
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Sort unique from multiple columns if criteria met

    Another formula.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Excel 365 (Windows) 64 bit
    AC
    13
    Outcome achieved
    14
    Community Access
    15
    Community Access - Group
    16
    Community Access - Individual
    17
    CRA
    18
    CRA - Category 2 - Host Home
    19
    Nursing Services
    20
    Nursing Services - RN
    21
    Occupational Therapy
    22
    Occupational Therapy - Evaluations
    23
    Specialized Medical Supplies
    Sheet: Sheet1

  12. #12
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    I am not too familiar with variable assignments. Can the responses use actual columns rather than references so I'm able to recreate as needed?

    I uploaded a new file and need a response on this file only.

    If State matches "A3", then I want just all colors in that row to be sorted/unique/filtered into Colors if State selected column. See Desired Outcome column. If criteria not met, then Colors (ALL) list shows.......thanks

  13. #13
    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,943

    Re: Sort unique from multiple columns if criteria met

    See attached AliG.
    It's AliGW. Please don't address me as Sacha Baron Cohen's alter ego!

    Try this:

    =UNIQUE(SORT(TOCOL(FILTER(Table2[[Color 1]:[Color 4]],Table2[State]=A3),1)))

  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,943

    Re: Sort unique from multiple columns if criteria met

    If you want to know the cells referenced, then convert the table to an array. I have done this underneath your table and used this formula:

    =UNIQUE(SORT(TOCOL(FILTER(D11:G17,C11:C17=A12),1)))

  15. #15
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    That worked! Thanks AliGW .

    How to modify so to show Colors (ALL) if criteria NOT met?

  16. #16
    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,943

    Re: Sort unique from multiple columns if criteria met

    Maybe:

    =IFERROR(UNIQUE(SORT(TOCOL(FILTER(D11:G17,C11:C17=A12),1))),UNIQUE(SORT(TOCOL(D11:G17,1))))

  17. #17
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    Sorry AliGW but that didn't work......

  18. #18
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Sort unique from multiple columns if criteria met

    I'm trying to get a modification to the following formula:

    =UNIQUE(SORT(TOCOL(FILTER(Table2[[Color 1]:[Color 4]],Table2[State]=$A$3),1)))


    Formula currently sort/filters all unique values in columns Color1 thru Color4 if State column matches criteria from "A3"....pretty straight forward.

    What I need: If criteria is not an option in State column then Colors if State selected should revert to Colors (ALL).

  19. #19
    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,943

    Re: If criteria not met then another list

    Maybe this:

    =IF($A$3="",UNIQUE(SORT(TOCOL(Table2[[Color 1]:[Color 4]],1))),UNIQUE(SORT(TOCOL(FILTER(Table2[[Color 1]:[Color 4]],Table2[State]=$A$3),1))))

    Your other thread has been closed, as you are merely requesting an amendment.
    Last edited by AliGW; 03-25-2024 at 09:44 AM. Reason: Typo fixed.

  20. #20
    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,943

    Re: Sort unique from multiple columns if criteria met

    Or maybe this:

    =IFERROR(IF($A$3="",UNIQUE(SORT(TOCOL(Table2[[Color 1]:[Color 4]],1))),UNIQUE(SORT(TOCOL(FILTER(Table2[[Color 1]:[Color 4]],Table2[State]=$A$3),1)))),UNIQUE(SORT(TOCOL(Table2[[Color 1]:[Color 4]],1))))

  21. #21
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: If criteria not met then another list

    Thanks AliGW for fixing my duplicate thread error.

    That formula only works if $A$3 is empty but looking for any situation that does not match $A$3.

    Like this one but with TOCOL to filter several columns:

    =SORT(UNIQUE(FILTER(Table2[Color 1], Table2[State]=$A$3, SORT(UNIQUE(Full_Service_List[Colors (ALL)])))))

  22. #22
    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,943

    Re: Sort unique from multiple columns if criteria met

    You obviously didn't look at the file attached to post #20. Look at that first, please - it allows for a mismatch OR the cell being empty.

  23. #23
    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,943

    Re: Sort unique from multiple columns if criteria met

    If that does what you need, then it can be condensed a touch:

    =LET(u,UNIQUE(SORT(TOCOL(Table2[[Color 1]:[Color 4]],1))),uf,UNIQUE(SORT(TOCOL(FILTER(Table2[[Color 1]:[Color 4]],Table2[State]=$A$3),1))),IFERROR(IF($A$3="",u,uf),u))

    For future reference, this:

    Sorry AliGW but that didn't work......
    was of no help at all. If you are going to state that something doesn't work, you need to say in what way: wrong result and what it should be, error message, misinterpreted requirement. "Didn't work" tells your helper nothing useful. And it was the middle of my night when you posted that, in case you were expecting an immediate response ...

  24. #24
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    Error output should be Full_Service_List table and not Color1 thru Color4, which is what I got from that formula.

    I tried to modify it with:

    =IFERROR(IF($A$3="",UNIQUE(SORT(TOCOL(Table2[[Color 1]:[Color 4]],1))),UNIQUE(SORT(TOCOL(FILTER(Table2[[Color 1]:[Color 4]],Table2[State]=$A$3),1)))),UNIQUE(SORT(Full_Service_List[Colors (ALL)])))

    but now output does not work when criteria is met........

  25. #25
    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,943

    Re: Sort unique from multiple columns if criteria met

    OK - this, then:

    =LET(u,UNIQUE(SORT(Full_Service_List[Colors (ALL)])),uf,UNIQUE(SORT(TOCOL(FILTER(Table2[[Color 1]:[Color 4]],Table2[State]=$A$3),1))),IFERROR(IF($A$3="",u,uf),u))

  26. #26
    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,943

    Re: Sort unique from multiple columns if criteria met

    Just caught an error - try this instead:

    =LET(u,UNIQUE(SORT(TOCOL(Full_Service_List[Colors (ALL)],1))),uf,UNIQUE(SORT(TOCOL(FILTER(Table2[[Color 1]:[Color 4]],Table2[State]=$A$3),1))),IF(ISNUMBER(MATCH(A3,Table2[State])),uf,u))

  27. #27
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    Still no. Output does not work if criteria IS met......

  28. #28
    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,943

    Re: Sort unique from multiple columns if criteria met

    Try post #26.

  29. #29
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Sort unique from multiple columns if criteria met

    Yep that's the winner...thanks

  30. #30
    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,943

    Re: Sort unique from multiple columns if criteria met

    Great - got there in the end.

+ 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. Count of unique text criteria in multiple columns
    By DAVEWRITER007 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-16-2020, 04:59 PM
  2. Count unique values from multiple columns with criteria
    By starter66 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-01-2019, 03:36 AM
  3. [SOLVED] Unique list with criteria, criteriarange multiple columns.
    By bakerman2 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-23-2018, 09:10 AM
  4. Filter - sort by criteria in multiple columns using Colour..
    By vba_madness in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-29-2014, 10:53 AM
  5. [SOLVED] Sort by multiple columns with sort criteria cell dependent
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-24-2014, 02:22 AM
  6. Count unique values across 2 columns with multiple criteria
    By Skywalker01 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-29-2012, 08:04 AM
  7. Replies: 11
    Last Post: 06-09-2011, 03:17 PM

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