How to sort multiple values in one cell?

Wijsvlok

New Member
Joined
Apr 15, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I am making a table with movies and their movie Genres alongside some other information.
Is there a way that i can sort by one Movie Genre even though some movies have more than one Genre.
For example


The hungergames science-fiction, Fantasy
Harry potter Fantasy, adventure
The Avangers Science-fiction, Action

now i would want to be able to sort by Science-fiction and get only the 1 and 3 movie and if i sort by Fantasy in my table i want to have the 1st and the 2nd one
the problem I have now at the moment is that i can only sort by: "Science-fiction, Fantasy" _ "Fantasy, Adventure" and "Science-Fiction, Action" due to it being in the same cell

Thanks in Advance
 

Attachments

  • afbeelding_2023-04-16_002153196.png
    afbeelding_2023-04-16_002153196.png
    36 KB · Views: 15

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi, see the linked file for a possible solution...
Wrong cells visible on Google Drive, because Google Drive does not know the FILTER function. The formula works correctly with your Office 365.

The formula used in the table...
=IFERROR(SORT(FILTER(Films!A:A;IFERROR(SEARCH(B1;Films!B:B&"#"&Films!C:C&"#"&Films!D:D);0)>0));"")

Films.xlsx

Films.png


Genres.png


FilmFilter.png
 
Upvote 0
Welcome to the MrExcel board!

i would want to be able to sort by Science-fiction and get only the 1 and 3 movie
Do you really mean sort, or do you mean filter?

1681638182164.png


From your description, it sounds like you actually want to filter.
If so, in the Genre column use 'Text Filters' and 'Contains'

1681638034147.png


.. and enter Science-Fiction -> OK

1681638119618.png


Result:

1681638228189.png
 
Upvote 0
Upvote 0
Upvote 0
Hi, I am very glad that the formula works.
If I have enough knowledge, I am happy to help at any time.
 
Upvote 0
Thank you so much this helped really good!
You're welcome.

If you are looking for a formula approach then a fairly simple one, using your existing table structure with multiple genres in the same column could be like this.

Wijsvlok.xlsm
ABCDEFGH
1Genres
2MovieGenreGenreScience-FictionScience-Fiction
3The HungergamesScience-Fiction, FantasyFantasy
4Harry PotterFantasy, adventureFilmsThe HungergamesAdventure
5The AvengersScience-Fiction, ActionThe AvengersAction
6
7
Films
Cell Formulas
RangeFormula
F4:F5F4=FILTER(Table1[Movie],ISNUMBER(SEARCH(F2,Table1[Genre])))
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
F2List=$H$2:$H$5
 
Upvote 0
Hi, I created a new table for multi filters.
(Wrong cells visible on Google Drive, because Google Drive does not know the FILTER function. The formula works correctly with your Office 365.)

The new formulas used in the new table...
Films!E2: =IF(A2="","",SUM((INDIRECT("FilmsMultiFilter!C1:C"&COUNTA(Genres!A:A))="YES")*IFERROR(SEARCH(INDIRECT("FilmsMultiFilter!B1:B"&COUNTA(Genres!A:A)),INDIRECT("B$"&ROW(A2))&"#"&INDIRECT("C$"&ROW(A2))&"#"&INDIRECT("D$"&ROW(A2)))>0,FALSE))) (Range: E2:E7...)
FilmsMultiFilter!E2: =IF(AND(K$1<>"AND",K$1<>"OR"),"",IFERROR(SORT(FILTER(Films!A:A,IF(K$1="AND",Films!E:E=COUNTA(FILTER(B:B,C:C="YES")),IFERROR(VALUE(Films!E:E),0)>0))),""))

Films2.xlsx

FilmsMultiFilter1.png


FilmsMultiFilter2.png
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top