Filtering for exact order of words

Girol

New Member
Joined
Oct 7, 2017
Messages
1
Hello,

I want to filter below column for PASIR GUDANG - SINGAPORE exact order.


[TABLE="width: 109"]
<colgroup><col></colgroup><tbody>[TR]
[TD]DURBAN[/TD]
[/TR]
[TR]
[TD]MUNDRA[/TD]
[/TR]
[TR]
[TD]KANDLA[/TD]
[/TR]
[TR]
[TD]PASIR GUDANG[/TD]
[/TR]
[TR]
[TD]PASIR GUDANG[/TD]
[/TR]
[TR]
[TD]PASIR GUDANG[/TD]
[/TR]
[TR]
[TD]SINGAPORE[/TD]
[/TR]
[TR]
[TD]KUALA TANJUNG[/TD]
[/TR]
[TR]
[TD]PORT LOUIS
PASIR GUDANG[/TD]
[/TR]
[TR]
[TD]MAPUTO
SINGAPORE [/TD]
[/TR]
[TR]
[TD]BELAWAN[/TD]
[/TR]
[TR]
[TD]BELAWAN[/TD]
[/TR]
[TR]
[TD]BELAWAN[/TD]
[/TR]
[TR]
[TD]PASIR GUDANG[/TD]
[/TR]
[TR]
[TD]SINGAPORE[/TD]
[/TR]
[TR]
[TD]KUALA TANJUNG[/TD]
[/TR]
[TR]
[TD]DURBAN[/TD]
[/TR]
[TR]
[TD]CAPE TOWN[/TD]
[/TR]
[TR]
[TD]SANTOS[/TD]
[/TR]
[TR]
[TD]PARANAGUA[/TD]
[/TR]
[TR]
[TD]PARANAGUA[/TD]
[/TR]
[TR]
[TD]SANTOS[/TD]
[/TR]
</tbody>[/TABLE]

If there is another city between, this should not be in the list.
[TABLE="width: 109"]
<tbody>[TR]
[TD]PASIR GUDANG[/TD]
[/TR]
[TR]
[TD]MAPUTO
SINGAPORE

[/TD]
[/TR]
</tbody>[/TABLE]

I hope you can help me with this.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Welcome to the board.

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
1​
[/td][td="bgcolor:#F3F3F3"]
City
[/td][td="bgcolor:#F3F3F3"]
Filter
[/td][td="bgcolor:#F3F3F3"]
[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
2​
[/td][td]DURBAN[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td]B2: =(A2="PASIR GUDANG")*(A3="SINGAPORE") + (A2="SINGAPORE")*(A1="PASIR GUDANG")[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td]MUNDRA[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
4​
[/td][td]KANDLA[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
5​
[/td][td]PASIR GUDANG[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td]PASIR GUDANG[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td]PASIR GUDANG[/td][td="bgcolor:#E5E5E5"]
1​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
8​
[/td][td]SINGAPORE[/td][td="bgcolor:#E5E5E5"]
1​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
9​
[/td][td]KUALA TANJUNG[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
10​
[/td][td]PORT LOUIS[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
11​
[/td][td]PASIR GUDANG[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
12​
[/td][td]MAPUTO[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
13​
[/td][td]SINGAPORE[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
14​
[/td][td]BELAWAN[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
15​
[/td][td]BELAWAN[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
16​
[/td][td]BELAWAN[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
17​
[/td][td]PASIR GUDANG[/td][td="bgcolor:#E5E5E5"]
1​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
18​
[/td][td]SINGAPORE[/td][td="bgcolor:#E5E5E5"]
1​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
19​
[/td][td]KUALA TANJUNG[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
20​
[/td][td]DURBAN[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
21​
[/td][td]CAPE TOWN[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
22​
[/td][td]SANTOS[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
23​
[/td][td]PARANAGUA[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
24​
[/td][td]PARANAGUA[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
25​
[/td][td]SANTOS[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[/table]
 
Upvote 0
You could also use Advanced Filter if you have a heading above the list.
I have the required order in H1
G1 is blank and G2 holds the formula shown


Book1
ABCDEFGH
1LocationPASIR GUDANG-SINGAPORE
2DURBANFALSE
3MUNDRA
4KANDLA
5PASIR GUDANG
6PASIR GUDANG
7PASIR GUDANG
8SINGAPORE
9KUALA TANJUNG
10PORT LOUIS
11PASIR GUDANG
12MAPUTO
13SINGAPORE
14BELAWAN
15BELAWAN
16BELAWAN
17PASIR GUDANG
18SINGAPORE
19KUALA TANJUNG
20DURBAN
21CAPE TOWN
22SANTOS
23PARANAGUA
24PARANAGUA
25SANTOS
Adv Fltr
Cell Formulas
RangeFormula
G2=OR(A1&"-"&A2=H$1,A2&"-"&A3=H$1)



Select A1:A?? (or your whole data range) and use Advanced (in the 'Sort & Filter' section of the Data ribbon tab)
Click OK if Excel says it can't determine the list.
Filter the list in place, Criteria range: G1:G2, OK

Result:


Book1
A
1Location
7PASIR GUDANG
8SINGAPORE
17PASIR GUDANG
18SINGAPORE
Adv Fltr
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,198
Members
453,022
Latest member
RobertV1609

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