katzwhite
asked on
What characters sort below Z in when sorting a singlc character col in ascending order
I thought finding the answer to the above would be easy, but so far no luck.
I need a printable character that will sort below z or Z when sorting a single col in normal sort order.
Thanks
Elton
I need a printable character that will sort below z or Z when sorting a single col in normal sort order.
Thanks
Elton
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
For a list of all the ASCII codes, try this little sub:
Public Sub ShowAscii()
Dim x
For x = 0 to 252 Step 4
Debug.Print x & ": " & Chr(x), x+1 & ": " & Chr(x+1), x+2 & ": " & Chr(x+2), x+3 & ": " & Chr(x+3)
Next
End Sub
Also, remember that each available code page has its own sort order, and you can change the default sort order in specific implementations (like InStr).
Public Sub ShowAscii()
Dim x
For x = 0 to 252 Step 4
Debug.Print x & ": " & Chr(x), x+1 & ": " & Chr(x+1), x+2 & ": " & Chr(x+2), x+3 & ": " & Chr(x+3)
Next
End Sub
Also, remember that each available code page has its own sort order, and you can change the default sort order in specific implementations (like InStr).
Depends what you mean by below. Z is asc 90, z is asc 122. A space, asc 32 is below 90 or 122, as are all the number digits and all the upper and lower case letters, and most punctuation marks.
ASKER
I have a table with a 1 char text col with some codes which as an example are:
B,C,N,3,7,~, Z and %
When I sort on this column in ascending order the rows display as follows from top to bottom on the screen:
%,~,3,7,B,C,N,Z
I would like to find some char to replace the %, ~ that would sort below the Z.
thanks for the asistance
Elton
B,C,N,3,7,~, Z and %
When I sort on this column in ascending order the rows display as follows from top to bottom on the screen:
%,~,3,7,B,C,N,Z
I would like to find some char to replace the %, ~ that would sort below the Z.
thanks for the asistance
Elton
In that case, simply look at the ASCII table (link provided by Nestorio, sub provided by me) and pick a character you like. Here's some sample for you:
88: X 89: Y 90: Z 91: [
92: \ 93: ] 94: ^ 95: _
96: ` 97: a 98: b 99: c
100: d 101: e 102: f 103: g
104: h 105: i 106: j 107: k
108: l 109: m 110: n 111: o
112: p 113: q 114: r 115: s
116: t 117: u 118: v 119: w
120: x 121: y 122: z 123: {
124: | 125: } 126: ~ 127:
128: € 129: 130: ‚ 131: ƒ
88: X 89: Y 90: Z 91: [
92: \ 93: ] 94: ^ 95: _
96: ` 97: a 98: b 99: c
100: d 101: e 102: f 103: g
104: h 105: i 106: j 107: k
108: l 109: m 110: n 111: o
112: p 113: q 114: r 115: s
116: t 117: u 118: v 119: w
120: x 121: y 122: z 123: {
124: | 125: } 126: ~ 127:
128: € 129: 130: ‚ 131: ƒ
Look at you Windows Character Map. left curly bracket, vertical bar, right curly bracket, {|} will do the trick.
Looking at that ASCII list, I just noticed tilde is 126, while z is 122. Shouldn't tilde come after 'z' in sort, then?
ASKER
So what am I doing wrong?
When I substiute any of the above characters that I can find on my keyboard and select the col, right click and sort ascending, the Z is still at the bottom of the list.
Elton
When I substiute any of the above characters that I can find on my keyboard and select the col, right click and sort ascending, the Z is still at the bottom of the list.
Elton
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or you could just look at the table via a query as I suggested a while back.
Walt
Walt
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It looks like it will be complicated to do, as the advanced sort will move the numbers below the alpha characters.
I appreciate the assistance.
I'll try to divide the points as each of you have provided interesting ideas and contributions.
Thanks
Elton
I appreciate the assistance.
I'll try to divide the points as each of you have provided interesting ideas and contributions.
Thanks
Elton
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.asciitable.com/