Sorting Data Not Work

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,089
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hello all..

i try to sort data asc to desc but not working , how to fixed it..

<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC;
}
.tableizer-table th {
background-color: #104E8B;
color: #FFF;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>sorted data</th></tr></thead><tbody>
<tr><td>5020103001-1</td></tr>
<tr><td>5020103001-10</td></tr>
<tr><td>5020103001-2</td></tr>
</tbody></table>


please, somebody help me...
thanks advance..

sst.<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
The problem you have is that your data is being sorted like text because it is text

One way:

With your data in cells A1 to A3
Formula in B1 copied down
=LEFT(A1,FIND("-",A1)-1)
Formula in C1 copied down
=VALUE(MID(A1,FIND("-",A1)+1,LEN(A1)-FIND("-",A1)))

Now sort
level 1 column B
level 2 column C
 
Last edited:
Upvote 0
Another way is to convert your data

with your data in cells A1 to A3

Formula in B1 copied down
=LEFT(A1,FIND("-",A1))&TEXT(MID(A1,FIND("-",A1)+1,LEN(A1)-FIND("-",A1)),"000")
 
Last edited:
Upvote 0
with your example: A1:A3
in B1: =BASE(MID(A1,SEARCH("-",A1)+1,99),10,3) and drag down
select columns A and B with data
sort column B by A-Z

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td]5020103001-1[/td][td]001[/td][td]B1: =BASE(MID(A1,SEARCH("-",A1)+1,99),10,3)[/td][/tr]

[tr=bgcolor:#FFFFFF][td]5020103001-2[/td][td]002[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]5020103001-10[/td][td]010[/td][td][/td][/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,226
Members
452,620
Latest member
dsubash

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