SORTBY formula

Nawar Jameel

New Member
Joined
Aug 14, 2023
Messages
18
Office Version
  1. 2013
Platform
  1. Windows
Hello

I've got this formula (=IFERROR(LET(u,UNIQUE(FILTER(Raw_Data!$C$2:$C$50007,Raw_Data!$A$2:$A$50007=A14)),IFERROR(TRANSPOSE(SORTBY(u,XMATCH(LEFT(u),{"C","P","CR"}))),"")),""))

Which currently give me this result
1722613118841.png


I need the outcome to be
1722613252627.png


I tried SMALL / LARGE formula but did not work out

Any help please

Thanks
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi

=BYCOL(SORT(SORT(VSTACK(LEFT(A2:G2),MID(A2:G2,2,20)),2,1,1),1,-1,1);LAMBDA(W,CONCAT(W)))
 
Upvote 0
Hi

=BYCOL(SORT(SORT(VSTACK(LEFT(A2:G2),MID(A2:G2,2,20)),2,1,1),1,-1,1);LAMBDA(W,CONCAT(W)))
Unfortunately, it did not work out (=BYCOL(SORT(SORT(VSTACK(LEFT(Raw_Data!$C$2:$C$50007),MID(Raw_Data!$C$2:$C$50007,2,20)),2,1,1),1,-1,1);LAMBDA(W,CONCAT(W))))

Any further solutions please

Thanks
 
Upvote 0
This one particular row is solvable e.g. via CHOOSECOLS and/or SEQUENCE but what is the general rule here? E.g. if the formula returns something that starts with CR or P02?
 
Upvote 0
Hi

=BYCOL(SORT(SORT(VSTACK(LEFT(A2:G2),MID(A2:G2,2,20)),2,1,1),1,-1,1),LAMBDA(W,CONCAT(W)))

hagia_sofia
E.g. if the formula returns something that starts with CR or P02?

Something different, you can always divide it with a dedicated formula
 
Upvote 0
Hi

=BYCOL(SORT(SORT(VSTACK(LEFT(A2:G2),MID(A2:G2,2,20)),2,1,1),1,-1,1),LAMBDA(W,CONCAT(W)))

hagia_sofia
E.g. if the formula returns something that starts with CR or P02?

Something different, you can always divide it with a dedicated formula

Hello ISY

Thanks for your reply

My formula is working OK but the results on rows are from (right to left) instead of (left to right)

For example, what I am getting now the results on rows as follows:
CR01C04C03C02C01P02P01


What I need are the same results on rows but on reverse only
P01P02C01C02C03C04CR01


Below is the formula

=IFERROR(LET(u,UNIQUE(FILTER(Raw_Data!$C$2:$C$50007,Raw_Data!$A$2:$A$50007=A14)),IFERROR(TRANSPOSE(SORTBY(u,XMATCH(LEFT(u),{"C","P","CR"}))),"")),"")


Hoping the above clarification meets your requirements.

Thank you very much.
 
Upvote 0
You can't use LEFT(u) to match against "CR" since it only returns one character.
 
Upvote 0
Like this?

Excel Formula:
SORTBY(SORT(u,,,TRUE),XMATCH(LEFT(SORT(u,,,TRUE),2),{"P0","C0","CR"}))
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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