An irritating autofilter sort problem.

MarkVMcCullagh

Board Regular
Joined
Oct 22, 2002
Messages
72
Hi
I have a list of alphanumeric part numbers all formatted as text. Some are pure digits while others are a combination. Why does autofilter treat the part numbers with digits as numbers and place them first in the list? Is there any way round this? Please try to keep it simple as I'm not really into VB. Thanks in advance.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Annoying isn't it? Formatting the cell as text does not change the underlying value (unless the cell is formatted as text before the value is entered).

Insert a column to the right of your data. In the first cell in your new column enter

=A1&""

replacing A1 with the reference to the first cell in your original list. Copy this formula down as far as needed. Select all the entries in the new column and choose Edit, Copy. Select the first cell in your original list and choose Edit, Paste Special, click Values and press OK. Then delete the new column.

The formula above coerces the entry to text, so the sort will work as you want.
 
Upvote 0
Thanks

I use =A1*1 to convert a text string of digits to numbers but hadnt thought of your solution for converting numbers to text.
 
Upvote 0
You could have also reparsed the column using the Text to Columns wizard, and in the
process uniformly converted the data type to Text.
 
Upvote 0
Instead, I use =A1+0 (zero) to convert a text string of digits to numbers.
 
Upvote 0

Forum statistics

Threads
1,215,379
Messages
6,124,608
Members
449,174
Latest member
ExcelfromGermany

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