Excel Logic for Sorting

smalik

Board Regular
Joined
Oct 26, 2006
Messages
134
Office Version
  1. 365
Platform
  1. Windows
Can someone please help me understand the logic for Sorting in Excel?

I have a column with Policy ID with 12 characters. The last three characters are just the sequence so they are not necessary when I am looking for unique IDs. I use the left function to pull the first 9 characters in a different cells. So when I sort the two columns I get different results based on which column I am applying the sort criteria.

Here are my results:
1624628500403.png


This seems to me that Excel is looking at the characters from left to right when doing the sort. Is this a correct assumption? I am getting two different results.

Thoughts? Comments?

Thanks in advance.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,890
Office Version
  1. 365
Platform
  1. Windows
It's reading it as a string, so depending on the Ascii code for each character, yes it will affect the sort, but yes it's left to right, just like

Abnormal precedes Apple which would precede Apples which would precede Apple1 and then Apple11 or Apple1_2 or Apple22 if you sort in ascending order
 
Solution

Forum statistics

Threads
1,141,284
Messages
5,705,493
Members
421,398
Latest member
Rahat Anwar

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
Top