Add a 'Sort' button to the tops of columns?

There has got to be a reasonably easy way to do this (by 'reasonable', I
mean a way that doesn't require me to become a programmer)...

How do I add a 'Sort' button to the tops of columns, so that I can
easily sort the data in a spreadsheet on different columns simply by
clicking the button in the column header?

I've seen these in spreadsheets I get from Excel users all the time, but
for the life of me can't figure out how to do this in Calc.

I can tell you how to sort a column or columns, but not how to add a sort button.

To sort data, first select the data you want to sort then DATA -> SORT.

Joe Conner, Poulsbo, WA USA

Hi :slight_smile:
In spreadsheets there is a danger with this. You can sort the single column
without the rest of the rows getting sorted so that John Doe could end up being
called John Dolittle while Eliza Dolittle ends up being Eliza Doe.

The better way is to select an area or all the rows and then use the tab-key (on
the keyboard) to get the currently selected cell (the one with the large black
border) into the column the you want to sort by. Then click the "A-Z" button
(on the icon bar), or the Z-A if you want reverse order. Note it also sorts
numbers and other ascii.

Databases are better at keeping relevant fields locked together for a particular
record/row. I think there is a way of defining a particular area in a
spreadsheet to do this but it's a lot more flaky than using a proper database if
you want to be able to add new rows/records.

Calc, Gnumeric and Excel all act the same way. I haven't tried others such as
google-docs or KOffice but i imagine they are about the same too.

Good luck and regards from
Tom :slight_smile:

Hi :slight_smile:
The
Data - Sort
method allows greater sophistication and flexibility and means that you can
select columns without having to use the tab-key method. It still has the same
vulnerability if the data area has not been set or selected. It might give you
an opportunity to define the data area but i haven't explored that.
Regards from
Tom :slight_smile:

You should already have sort buttons on the Standard Toolbar. If not:
View>Toolbar>Customize>Toolbars>Standard - scroll down to ensure that
the 'Sort Ascending' and 'Sort Decending' commands are checked.

Can you post a sample somewhere? I know that when you turn on 'Auto
Filter' in Excel and LO it will add a dropdown filter button to the
header. But I've not seen an 'Sort' button on a column header.

Thanks - I know how to sort the data manually. I want to know how to add
a button so that my users can do it with the click of a button...

Hmmm... maybe that is why I titled the subject of the email and worded
the question the way I did - ya think?

Crap... yeah, that's what I was seeing...

But I just can't imagine this is so hard...

I just want to be able to click a column header, and have that execute a
'Sort Rows B3 thru Y18 by column R in descending order'...

Then, if I click the column header again, have it sort it in the
opposite order.

And yes, I know a database would be better for this, but it isn't a
database, the boss wants it done in a spreadsheet... and I'm not a VB
(or whatever the equivalent is in calc) programmer)...

Database.

What you are looking for is a fairly standard database function. People find a
nicely done "form" in a database is much easier than fumbling with a
spreadsheet. Spreadsheets are for fairly advanced users with fairly good maths
skills and/or logic. A database keeps the data safe from most common blunders
that people often make with spreadsheets and allows various reports to be
pulled-off reasonably easily. It also allows people with artistic skills to
create a nicer looking form without necessarily seeing the data.

Regards from
Tom :slight_smile:

<sigh> I really hate it when I ask someone for an apple, and they
persist in trying to convince me that what I really want is a lemon.

There has got to be a reasonably easy way to do this (by 'reasonable', I
mean a way that doesn't require me to become a programmer)...

How do I add a 'Sort' button to the tops of columns, so that I can
easily sort the data in a spreadsheet on different columns simply by
clicking the button in the column header?

I've seen these in spreadsheets I get from Excel users all the time, but
for the life of me can't figure out how to do this in Calc.

Can you post a sample somewhere? I know that when you turn on 'Auto
Filter' in Excel and LO it will add a dropdown filter button to the
header. But I've not seen an 'Sort' button on a column header.

Crap... yeah, that's what I was seeing...

But I just can't imagine this is so hard...

I just want to be able to click a column header, and have that execute a
'Sort Rows B3 thru Y18 by column R in descending order'...

Then, if I click the column header again, have it sort it in the
opposite order.

I've only see that (from google) done as a macro.

And yes, I know a database would be better for this, but it isn't a
database, the boss wants it done in a spreadsheet... and I'm not a VB
(or whatever the equivalent is in calc) programmer)...

As for Autofilter. Autofilter is easy: Select the column(s) data area(s)
in the columns & Data|Filter|Autofilter
That will ask you if you want to use the first line to be used as the
column filter if you do not have column headers defined already.

Note: when opening an .xls with autofilters, LO will not include/show
the autofilters in the .xls. Unfortunately you'll need to review the
.xls in Excel/Excel Viewer & then add your own in LO. This probably
should be (if not already) filed as a bug as LO should open the .xls
with the autofilters enabled.

Hi :slight_smile:
Excel and the xls or xlsX formats have a LOT of vulnerabilities in amazingly
basic functions. Their macros have often carried malware and many organisations
block macros as a result. I have a feeling the reason LibreOffice/OpenOffice
have such different systems for macros is to make sure those types of
vulnerabilities don't exist. IF it's the same for autofilters then the
bug-reports should be filed with MS against Excel.
Regards from
Tom :slight_smile:

Hi :slight_smile:
Sadly if you want to go from Buckingham Palace to Marble Arch you can't choose
to go by ocean liner, at least not until after doing massive engineering works
or using enough explosives to blow a decently large hole in the centre of
London. If you want to go deep-sea diving then a horse and cart are unlikely to
get you down far enough and then up again. A hammer is not an effective nail
and a nail is fairly useless as a hammer (except for fairly tiny objects)
Regards from
Tom :slight_smile:

From: Tanstaafl <tanstaafl@libertytrek.org>
To: users@global.libreoffice.org
Sent: Fri, 10 June, 2011 23:45:13
Subject: Re: [libreoffice-users] Add a 'Sort' button to the tops of columns?

> What you are looking for is a fairly standard database function.
> People find a nicely done "form" in a database is much easier than
> fumbling with a spreadsheet. Spreadsheets are for fairly advanced
> users with fairly good maths skills and/or logic. A database keeps
> the data safe from most common blunders that people often make with
> spreadsheets and allows various reports to be pulled-off reasonably
> easily. It also allows people with artistic skills to create a nicer
> looking form without necessarily seeing the data.

<sigh> I really hate it when I ask someone for an apple, and they
persist in trying to convince me that what I really want is a lemon.

--
Unsubscribe instructions: E-mail to users+help@global.libreoffice.org
In case of problems unsubscribing, write to postmaster@documentfoundation.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be

deleted

Hi :slight_smile:
If macros are the answer then this link might help
http://docs.google.com/viewer?a=v&q=cache:ZIjfkAMSUrQJ:wiki.services.openoffice.org/w/images/b/ba/0312CG-CalcMacros.pdf+Sort+button+macro+Calc&hl=en&pid=bl&srcid=ADGEESgBjm5T8fI10vLhGVuY4ZCo7ypUagt_0phAX3JZM0lBgiaI3S7MkPRj9q2QVt2B9fpTN3fnyIZo97VZ16HaAC9j9zmhW8CAvdO3rlRygEM2hmEaQlq_gEBhDMKV4fqjkzeoGotF&sig=AHIEtbTvK5PQsv50y7aj_uJEJBn3TZnPQg

It involves a type of programming or coding and the result is not compatible
with MS Office (luckily). It also doesn't increase flexibility for future
developments of the spreadsheet/database.

This forum thread might be useful for creating the macro
http://user.services.openoffice.org/en/forum/viewtopic.php?f=21&t=1254

Regards from
Tom :slight_smile:

From: Tanstaafl <tanstaafl@libertytrek.org>
To: users@global.libreoffice.org
Sent: Fri, 10 June, 2011 23:45:13
Subject: Re: [libreoffice-users] Add a 'Sort' button to the tops of columns?

> What you are looking for is a fairly standard database function.
> People find a nicely done "form" in a database is much easier than
> fumbling with a spreadsheet. Spreadsheets are for fairly advanced
> users with fairly good maths skills and/or logic. A database keeps
> the data safe from most common blunders that people often make with
> spreadsheets and allows various reports to be pulled-off reasonably
> easily. It also allows people with artistic skills to create a nicer
> looking form without necessarily seeing the data.

<sigh> I really hate it when I ask someone for an apple, and they
persist in trying to convince me that what I really want is a lemon.

--
Unsubscribe instructions: E-mail to users+help@global.libreoffice.org
In case of problems unsubscribing, write to postmaster@documentfoundation.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be

deleted

Ok, well, like I said, ianap, so any help would be appreciated...

I guess I'll go add a feature enhancement request to make this easy -
maybe a button with a pre-defined macro, where the RANGE simply must be
defined...

In the meantime, does anyone happen to have a macro already built that
does this where I could simply change the data range?

Would be mucho appreciated...

Irrelevant and off point.

Sorting data in a spreadsheet is basic spreadsheet functionality. Adding
the ability to do so with a button (after defining the data range)
*should* be trivial.

Tom - please stop responding to my posts if you cannot be helpful.

Tanstaafl wrote:

Sorting data in a spreadsheet is basic spreadsheet functionality. Adding
the ability to do so with a button (after defining the data range)
*should* be trivial.
...
I just want to be able to click a column header, and have that execute a
'Sort Rows B3 thru Y18 by column R in descending order'...

If B3:Y18 is a table with A1:A18 and Z1:Z18 empty and you don't have merged
cells in row 1 and 2, it is trivial :
Click on a cell in colum R, then click on the icon (ZA descending order).

If column A or Z contains datas :

If rows 1 & 2 do not contains merged cells : highlight B2:Y18 then Menu Data

Define range, more → check contains column labels

If rows 1 & 1 contains merged cells : highlight B3:Y18 then Menu Data >
Define range, more → uncheck contains column labels.

After this you can use sort icon : Click on a cell in colum R, then click on
the icon (ZA descending order).

Gérard