Incorrect Sorting?

Discuss the spreadsheet application
Locked
NotLeftBehind
Posts: 67
Joined: Mon Sep 23, 2013 3:57 am
Location: NC, USA, Earth, Sector 001

Incorrect Sorting?

Post by NotLeftBehind »

I am trying to figure this one out. I got two issues with this example. I assume because of the dashes.

One, I will sort by SET1 then SET2 and the numbers are not in order. The numbers starting in 9 should be first in both columns. It should be that 969 be first in both sides.

Two, even sorting the columns both ascending, numbers come backwards. Look at the highlighted groups. Even removing the dashes, making the numbers now what they are, but in doing so the right column still sorts opposite.

Not the results I was expecting.

Might be Monday, but....
Attachments
example1.ods
(21.63 KiB) Downloaded 168 times
LibreOffice 7.4.4.2 (x64) on Windows 11 Pro
User avatar
RoryOF
Moderator
Posts: 35210
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Incorrect Sorting?

Post by RoryOF »

Mixed data types; /View /Value Highlighting to see.
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
NotLeftBehind
Posts: 67
Joined: Mon Sep 23, 2013 3:57 am
Location: NC, USA, Earth, Sector 001

Re: Incorrect Sorting?

Post by NotLeftBehind »

Nothing happens. On other sheets, that seems to turn DATE cells blue, but does nothing on this sheet.
LibreOffice 7.4.4.2 (x64) on Windows 11 Pro
User avatar
RoryOF
Moderator
Posts: 35210
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Incorrect Sorting?

Post by RoryOF »

It doesn't DO anything - it tells you about your data. Look up "highlighting" in the Help and then adjust your data.
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Incorrect Sorting?

Post by acknak »

The results of sorting depends on what data type Calc uses to store the values; numeric or text. For example, the sorting rules say that any number comes after any text, so the number zero will come AFTER the text 9999999. This looks completely wrong on the screen because you can't see that 9999999 is not a number at all.

You have the opposite situation. The items that look like numbers (no dash) Calc has converted to numbers, and the items like 1011-1014 are all text because they can't be converted to a number, and thus they always come before any of the numbers.

Here's your sample with all the items in set2 converted to text, then sorted. You can see that the sort interleaves all the items because now they are all the same data type.
Attachments
example1_astext.ods
(19.41 KiB) Downloaded 122 times
AOO4/LO5 • Linux • Fedora 23
Alex1
Volunteer
Posts: 852
Joined: Fri Feb 26, 2010 1:00 pm
Location: Netherlands, EU

Re: Incorrect Sorting?

Post by Alex1 »

Select column B and click Data, Text to Columns, use the dash as the separator. Then do the same for column A after inserting an empty column between A and B. Then you can sort the data using their numerical value.
AOO 4.1.16 & LO 25.8.3 on Windows 10
DFW333
Posts: 18
Joined: Sat Oct 04, 2014 1:58 am

Re: Incorrect Sorting?

Post by DFW333 »

I'm having a problem getting it to sort a list of prices properly. I have a column for business names, a column for addresses and a column for cost. I need to sort by cost, lowest price to highest price. The entire column has been formatted to be currency. And I have even retyped the numbers into the cells manually after changing the format. Yet it still shows the spreadsheet sorted in the column by this order:

$100
$100
$100
$100
$185
$39.95
$40
$40 and so on

Why is it putting $100 at the top of the range? Granted "1" is less than "3" but this program should be able to understand the concept of hundreds vs tens. All the other numbers are sorted correctly.
Open Office 4.1.4
Windows 7 Home Premium 64-Bit (6.1, Build 7601)
User avatar
Zizi64
Volunteer
Posts: 11505
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Incorrect Sorting?

Post by Zizi64 »

Your "numbers" are not numeric values, but they are strings.
Please upload your example .ods document here ( with a few formatted "currency values").
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Locked