Sort range based on specific characters, Formula or VBA

rmence

New Member
Joined
Oct 20, 2015
Messages
23
Afternoon, this forum has been extremely helpful over the years... hope to find some help again.

I am trying sort a range of cells based on specific characters, it is hard to describe so let me post an example.

I want to turn this:

Real PosNamePos SortedName Sorted
C47531-80821:Jarrett AllenPG
PG47531-97018:Chris ChiozzaPG
PF47531-81529:Daniel TheisSG
SG47531-84669:Luka DoncicSG
PF47531-84683:Jaren JacksonSF
SF47531-40199:Giannis AntetokounmpoSF
SG47531-16261:Khris MiddletonPF
PG47531-67708:Dejounte MurrayPF
SF47531-110347:Keldon JohnsonC
0​
0​
PG47531-97018:Chris ChiozzaPG
SG47531-84669:Luka DoncicPG
PF47531-20491:Robert CovingtonSG
PF47531-84683:Jaren JacksonSG
SF47531-40199:Giannis AntetokounmpoSF
SG47531-16261:Khris MiddletonSF
C47531-58378:Jakob PoeltlPF
PG47531-67708:Dejounte MurrayPF
SF47531-110347:Keldon JohnsonC
0​
0​

Into this:

Real PosNamePos SortedName Sorted
C47531-80821:Jarrett AllenPG47531-97018:Chris Chiozza
PG47531-97018:Chris ChiozzaPG47531-67708:Dejounte Murray
PF47531-81529:Daniel TheisSG47531-84669:Luka Doncic
SG47531-84669:Luka DoncicSG47531-16261:Khris Middleton
PF47531-84683:Jaren JacksonSF47531-40199:Giannis Antetokounmpo
SF47531-40199:Giannis AntetokounmpoSF47531-110347:Keldon Johnson
SG47531-16261:Khris MiddletonPF47531-81529:Daniel Theis
PG47531-67708:Dejounte MurrayPF47531-84683:Jaren Jackson
SF47531-110347:Keldon JohnsonC47531-80821:Jarrett Allen
0​
0​
PG47531-97018:Chris ChiozzaPG47531-97018:Chris Chiozza
SG47531-84669:Luka DoncicPG47531-67708:Dejounte Murray
PF47531-20491:Robert CovingtonSG47531-84669:Luka Doncic
PF47531-84683:Jaren JacksonSG47531-16261:Khris Middleton
SF47531-40199:Giannis AntetokounmpoSF47531-40199:Giannis Antetokounmpo
SG47531-16261:Khris MiddletonSF47531-110347:Keldon Johnson
C47531-58378:Jakob PoeltlPF47531-20491:Robert Covington
PG47531-67708:Dejounte MurrayPF47531-84683:Jaren Jackson
SF47531-110347:Keldon JohnsonC47531-58378:Jakob Poeltl


So I would like to learn how to (thru formula or VBA) copy the B column to the D column based on the C column (in this case their basketball position). Trying formulas I am getting confused with the second "PG" etc etc. Also, I think I might have to learn more VBA because the sets of 9 go on for a while, sometimes hundreds... I only copied 2 from my opensolver output. Let me know if I need to elaborate... I am not sure if I am explaining myself thoroughly.

Any help or direction you folks can provide would be very sincerely appreciated.
Thanks.
-Rick
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Seeing as your sorted list doesn't appear to fit any normal sorting convention i.e. AlphaNumeric, Color etc. I think that you will probably have to look at doing a Custom Sort (I also can't see anything to distinguish the top half of your data from the bottom half).

Have a look at the link below for some basics on Custom Sorting...

 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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