ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Soritng with text strings prefixed with single quote (https://www.excelbanter.com/excel-discussion-misc-queries/171505-soritng-text-strings-prefixed-single-quote.html)

jjk98

Soritng with text strings prefixed with single quote
 
In a question yesterday (thanks for the help) I noted that I could not find
any difference in the handling of text prefixed with a single quote. Now I
have found a very significant difference.

If the string is prefixed with a single quote it always comes before the
identical text without the quote in a sort on that field. For example if one
has the data

abc A
abc B
abc C
'abc A
'abc B
'abc C

and I sort on the first column, and then the second, the order above is not
changed where I would expect to find the resutl to be

abc A
'abc A
abc B
'abc B
abc C
'abc C

ALL of the fields are explicitly typed as text. The worksheet has 15,000
rows and 15 columns and the leading quote appears to be randomly used
throughout.

How do I make sort work properly?
--
Thanks for your help - jjk98

Mike H

Soritng with text strings prefixed with single quote
 
I get the result that you expect to get

"jjk98" wrote:

In a question yesterday (thanks for the help) I noted that I could not find
any difference in the handling of text prefixed with a single quote. Now I
have found a very significant difference.

If the string is prefixed with a single quote it always comes before the
identical text without the quote in a sort on that field. For example if one
has the data

abc A
abc B
abc C
'abc A
'abc B
'abc C

and I sort on the first column, and then the second, the order above is not
changed where I would expect to find the resutl to be

abc A
'abc A
abc B
'abc B
abc C
'abc C

ALL of the fields are explicitly typed as text. The worksheet has 15,000
rows and 15 columns and the leading quote appears to be randomly used
throughout.

How do I make sort work properly?
--
Thanks for your help - jjk98


jjk98

Soritng with text strings prefixed with single quote
 
Must be something else in the text then, I'll keep looking...

Thanks!
--
Thanks for your help - jjk98


"Mike H" wrote:

I get the result that you expect to get

"jjk98" wrote:

In a question yesterday (thanks for the help) I noted that I could not find
any difference in the handling of text prefixed with a single quote. Now I
have found a very significant difference.

If the string is prefixed with a single quote it always comes before the
identical text without the quote in a sort on that field. For example if one
has the data

abc A
abc B
abc C
'abc A
'abc B
'abc C

and I sort on the first column, and then the second, the order above is not
changed where I would expect to find the resutl to be

abc A
'abc A
abc B
'abc B
abc C
'abc C

ALL of the fields are explicitly typed as text. The worksheet has 15,000
rows and 15 columns and the leading quote appears to be randomly used
throughout.

How do I make sort work properly?
--
Thanks for your help - jjk98



All times are GMT +1. The time now is 02:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com