sorting decmials

Porknar

Board Regular
Joined
Jan 19, 2006
Messages
59
Is there a way to sort the following:


20.1
20.2
20.10
20.20

as of now it sort these as

20.1
20.10
20.2
20.20

Thanks,
Darrell
 

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

njimack

Well-known Member
Joined
Jun 17, 2005
Messages
7,772
Apart from the formatting, is there any difference between 20.1 and 20.10?
 

kpark91

Well-known Member
Joined
Jul 15, 2010
Messages
1,582
there's a zero at the end for 20.10 and 20.1 has nothing in the hundredth place..

If it is in text formatting, making a vb code to temporarily change the string into numbers and sorting them wouldn't be an useless idea.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,208
Porknar,

Is the text formmating something that you are want or is it something that you are given and have to put up with? i.e. do you (and the use to which you are putting these numbers) think that 2.10 = 2.1 ?

If so, it would probably pay off in the long run, the data was converted from text formatting to general. TextToColumns is a quick way to do that.
 

Porknar

Board Regular
Joined
Jan 19, 2006
Messages
59

ADVERTISEMENT

Porknar,

Is the text formmating something that you are want or is it something that you are given and have to put up with? i.e. do you (and the use to which you are putting these numbers) think that 2.10 = 2.1 ?

If so, it would probably pay off in the long run, the data was converted from text formatting to general. TextToColumns is a quick way to do that.

I understand that 2.10 = 2.1, I want to sort as two point 1 and two point ten.

I can format it either way text or general. Will using general allow me to sort in the manner I want?
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,208
Getting those out of text format and into General (with numeric entries) will sort them properly.

But after being sorted, you won't be able to tell which was 2.1 and which was 2.10 at the start of it all.

Let me put it another way.
If your original (two columns) data is
3.2 A
2.1 B
1.56 C
2.10 D
convert to numbers and sort will result in
1.56 C
2.1 B
2.1 D
3.2 A

If your original (two columns) data is
3.2 A
2.10 B
1.56 C
2.1 D
convert to numbers and sort will result in
1.56 C
2.1 B
2.1 D
3.2 A

Note that the order of (original data) 2.1 and 2.10 are not changed by "convert to number and sort".
 
Last edited:
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,188
Messages
5,835,891
Members
430,392
Latest member
bongouni553

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