Ask Your Question
1

Calc: Sorting by Multiple Rows/Criteria [closed]

asked 2013-12-28 18:28:08 +0200

oliko gravatar image

Hello,

I have the following table:

Name    Value
A   34
B   53
C   13
D   1
D   45
D   90
A   54
C   3
A   77
A   43

That I would like to convert into:

Name    Value
A   34
A   43
A   54
A   77
D   1
D   45
D   90
B   53
C   3
C   13

As you can see the aim is to first sum the values for each name, and then sort the names based on their summed value. So in this case the total value of all A's is 208 which is the biggest value so I want the A's to be first, D's are second so I want them second, the only B has a total value greater than all C's so it's above the C's.

I still want to keep each row though as it's important for me to see each individual value.

Is something like that possible?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-11-16 18:41:11.884812

1 Answer

Sort by » oldest newest most voted
2

answered 2013-12-28 19:44:57 +0200

m.a.riosv gravatar image

updated 2013-12-28 23:06:54 +0200

Hi @oliko, I think the proper tool in calc is the Pivot Table Menu/Data/Pivot Table.

Open the attached file to see a sample: Sum&Sort.png (please change the extension to .ods, here is a issue to upload files with odf extensions)

The trick is set up the Name to be sorted by their sum. image description

Edited:

Another way to do it: Add a third column with the sum for every value, what you can use to sort, (Menu/Data/Sort).

image description

edit flag offensive delete link more

Comments

Thank you - this works very well! Not the most elegant solution - since I can't tweak the values in the cells - it's more of a display solution, but nonetheless - a solution! I reckon if I copy/paste the output back into a sheet I'll get a normal table that I can work with and it will also be sorted! So thank you once more - you truly saved the day!

oliko gravatar imageoliko ( 2013-12-28 22:17:47 +0200 )edit
2

Where you can tweak the values is in the source table, right-click in Pivot Table and Refresh.

m.a.riosv gravatar imagem.a.riosv ( 2013-12-28 22:58:13 +0200 )edit

RE: Your EDIT - using SUMIF!

Now that is an ELEGANT SOLUTION!

I was struggling to come up with something like this, but I never thought of something as simple and elegant as this!

Thank you once again - words cannot express my smile right now! :)

oliko gravatar imageoliko ( 2013-12-29 12:41:05 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2013-12-28 18:28:08 +0200

Seen: 3,573 times

Last updated: Dec 28 '13