Super Advanced Search Algorithm Annoyance

IREALLYambatman

Board Regular
Joined
Aug 31, 2016
Messages
63
Sooo.. I have a ton of data and I need it arranged all by one Row... And using Regex, and custom order, and ascending.. I'm 90% of the way there, unfortunately I'm now kinda stuck, I need to sort like this :

[TABLE="width: 500"]
<tbody>[TR]
[TD]AAA[/TD]
[TD]AAA x2[/TD]
[TD] AAA x5[/TD]
[TD]AAA x10[/TD]
[/TR]
</tbody>[/TABLE]

And Excel does this:

[TABLE="width: 500"]
<tbody>[TR]
[TD]AAA[/TD]
[TD]AAA x10[/TD]
[TD]AAA x2[/TD]
[TD]AAA x5[/TD]
[/TR]
</tbody>[/TABLE]

So Excel Looks at each charecter and says that x10 should come before X2 because you well, it fails to understand that 10 < 2.

What can I do to fix this? I have all the rest done, all the AAA's and BBB's are in order, it's just the x2 or x5 or x20 or xwhatever that it fails to realize that is a number.. help?
 
Last edited:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Classing sorting "numbers as text" issue
- easily solved if you make numbers consistent
- insert leading zeros
- with your example increase all numbers to 2 digits
- if largest number is 3 digits then make EVERY number 3 digits


So instead of
[TABLE="class: cms_table"]
<tbody>[TR]
[TD]AAA [/TD]
[TD] AAA x2
[/TD]
[TD] AAA x5
[/TD]
[TD] AAA x10
[/TD]
[/TR]
</tbody>[/TABLE]

Amend data like this and the problem goes away
[TABLE="class: cms_table"]
<tbody>[TR]
[TD]AAA[/TD]
[TD] AAA x02
[/TD]
[TD] AAA x05
[/TD]
[TD] AAA x10
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Classing sorting "numbers as text" issue
- easily solved if you make numbers consistent
- insert leading zeros
- with your example increase all numbers to 2 digits
- if largest number is 3 digits then make EVERY number 3 digits


So instead of
[TABLE="class: cms_table"]
<tbody>[TR]
[TD]AAA[/TD]
[TD] AAA x2[/TD]
[TD] AAA x5[/TD]
[TD] AAA x10[/TD]
[/TR]
</tbody>[/TABLE]

Amend data like this and the problem goes away
[TABLE="class: cms_table"]
<tbody>[TR]
[TD]AAA[/TD]
[TD] AAA x02 [/TD]
[TD] AAA x05[/TD]
[TD] AAA x10[/TD]
[/TR]
</tbody>[/TABLE]
thanks dude, you rock!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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