Hi! Is there a feature "Sort or filter by cell background color" in Libreoffice Calc? If not, is there a hack to filter cell by background color? Thanks. Edited

Libreoffice 6.4.5
Ubuntu 20.04 LTS

This is not a good title. Please change it so that it summarizes the question. Then provide more details in the question body. Is this cell background color or text color, and are styles involved? Also, give an example of how the colors should be sorted. What colors come first?

The question seems clear enough to me. Excel has had this for some time now…after setting up auto-data filters to column tops, on pulling down any of those column-heading menus, one will see an obvious “sort by color…” option that’s not in the same place in Calc, if it exists anywhere. It lets the user filter cells by color, of course, which is a great visual method I use for tagging rows I want to follow up on. I’ll keep looking.

@DaveS1: Why don’t you open a new question and add a link to this one? First, take a look at guidelines for asking. Recognize that many of us do not use Excel, so be sure to explain exactly what is needed.

Question reformulated

The question seems clear enough to me

Question reformulated

The question is formulated bad in the sense that all the question is fit into the title, and the description is almost empty, while it should be like this:

  • title:

e.g. Sort or filter by cell background color in Libreoffice Calc (so it gives a brief idea what it is about)

  • description:

Hi! Is there a feature “Sort or filter by cell background color” in Libreoffice Calc? If not, is there a hack to filter cell by background color? I’m using Libreoffice 6.4.5 on Ubuntu 20.04 LTS. Thanks.

Just a style issue, not a big deal :slight_smile:

And no, there’s no such feature yet… tdf#76258, tdf#95520.

If there was such a feature it would encourage users to code relevant information using CellBackColor instead of explicit cell content. Such ways of “coding” are bad and dangerous for many reasons.
In addition users filtering by color would very likely also expect the filter to work with conditionally applied (CF) colors not understanding the difference. If I am asked I will opt against such a feature.

I’m having a devil of a time transitioning to Calc from Excel without this functionality. Filter is not good. The Remove Duplicates extension also does not do quite what I’m used to and need. The combination of Conditional Formatting and Sort by Format does what I need. Conditional Formatting highlights the duplicate values, then Sort by Format brings them to the top for analysis where I can manually sort them into two groups: one group where one instance will be removed, and the other group where both instances will be removed. Anyone got a way in LibreOffice to do that doesn’t involve a big tutorial on calculations?

Cell formatting, such as font and colour, should only change the presentation of a cell, not its underlying value. Imagine if calculations involving cell values (such as sorting) could depend on formatting: Changing the font (or any part of the formatting) of a cell in some spreadsheet could actually break a calculation if a particular formula depended on certain values being in Comic Sans size 5 with orange background with a cell width of 0.1.

I am somewhat frightened that a question like this is even asked (and asked often), as that would mean that if this functionality was available, people would indeed use it. You can get the colour of a cell using macros, but please don’t.

Instead of embedding information within the formatting, you should store it as a separate value. For example, if you have a column called fruit where one cell has the value apple, and you want to record that the apple is green, then do not just apply a green colour to the text apple. Instead create a colour column where the cell on the same row as apple has the value green.

I basically do that when I create spreadsheets (having extra columns for sorting), but I regularly receive files from MS-Office users who tell me “just sort by the color” and it is tiresome explaining every time that my tool cannot do that. They are not trying to annoy me, they just use their tool the way they always do.

Please allow me to quote somebody else:
[…] the answer to “Train has overturned, people are trapped” is not “Train is designed to be operated in an upright fashion”. Highlighting names by background color is a natural way for people to work.


This is the dumbest answer to a legitimate question. Don’t be so frightened, Excel has been doing it successfully for a while and since Libreoffice Calc is the poor man’s Excel, so folks, myself included, are looking for this time saving feature.

I’m still wondering why the feature “filter by cell background color” is not yet implemented in Calc LibreOffice… such a basic feature

and since Libreoffice Calc is the poor man’s Excel

OMG. How people are misled… (irrespective to my opinion on this request, which I personally don’t need, but suppose to be implemented sooner or later anyway).

minus 10 for implementation!
The feature is neither basical nor actually useful. To the contrary it would cause problems and errors in different ways, disscussed over and over in real formus.
Nowadays I waste time again and again due to the habit of users to prefer stubborn and silly date formats - and often not being aware of the needs of text-based communication.
I really don’t need users not knowing of the fact that often hundreds if not thousands of colors are not distinguishable to the human eye or shown very differently on different screens, that there are no reliable ways to define a term like “red” beyond the usage in a palette, and that palettes cannot be guarenteed to be long-term stable let allone to be compatible across applications - but expecting me to waste my remaining time with helping them out of the mess they made.

@Lupp: agree. However, I am sure that in practice someone will implement that. Too much wanted by many.

Quoting @mikekaganski:

…I’m sure … someone will implement that …

As an incurable optimist I don’t feel quite sure, but I’m afraid, I’m wrong.
This is one of the cases where my suspicion tells me that MS-And-All developers also know how bad and dangerous such a feature is. If they actually implemented it, it must have been due to being forced by a mangement decision based on one truth: The only reason for anybody to buy/use our software is its incompatibility. They cannot take the risk to be compatible. But they may simulate an approach.

(I wouldn’t search for it now, but actually I once wrote a bit of Basic code to help somebody to get a rough binning of our 2^24 colors under the labels “red”, “yellow”, and something else. I told him to exclusively use my help to find his cell ranges for re-coding the information into actual data. That was an interesting piece of “research and use” on my level of knowledge about colors, but I won’t do it a second time.)

Here’s a real life use case of why sort by color is useful. I work with software that creates reports. When I import my tens of thousands of rows of data, the software generates a report with the same data, and color codes the rows that failed to import. THOUSANDS of them. It WOULD be very USEFUL to just sort by color, so all the thousands and thousands of rows that errored out can float up so I can deal with them quickly. Instead, I have to literally waste half a day trying to do this other ways. Being an academic snob about how people use data, shouldn’t impact real life applications. I agree that information shouldn’t be contained in formatting… however WHEN IT IS… you need a tool that can handle it. I’d rather have a robust method of sorting by colors built in, than having to figure one out every time I encounter this problem. For those of you that know better, don’t do it. But when you have to work on someone else’s data, sometimes you don’t have the choice.

@Lupp you can’t see the utility of combing Conditional Formatting with Sort by Format? What are you missing? It makes for an extremely easy UX to find duplicates – for example – with Conditional Formatting and then also sort those duplicates to the top for analysis by sorting by the same format parameter you just used in conditional formatting. This simple combination of features allows users to not learn what the F this “=VLOOKUP(A22,E:F,1,0)” means. I just want to easily “tell” Calc, “highlight all the dupes black; now bring all the cells highlighted black to the top.” Do you have an easy way to do this that already exists because I’ll shut up about Sort by Format if there is.

There is a simple reason why libreoffice needs the filter by color option. Because google sheets and microsoft excel do it.

Increasingly I’m working with others in groups, and by so doing am being herded into the google documents realm because it’s “free.” When I want to download a spreadsheet shared from someone else, and the entire thing is dependent on this filtering by color capability because that’s the way THEY built it, it immediately renders LibreOffice useless to me, adding more pressure to have to drop libreoffice and be stuck with google/Microsoft.

It may not be a purists dream codewise, but Google, Microsoft, and the rest of the millions and millions of their users don’t care about that. They care about what it does and the way they are now accustomed and want to do it.

PLEASE adapt or increasingly I’ll be forced off the LibreOffice platform!

OR, better yet, create a cloud-based libreoffice platform to compete head on, if only there were a way to fund it!

MS and Google will never be fully compatible with one another,and none of them can accept a fully compatible FLOSS competitor. Whatever nonsense LibO might implement in the bad traditions cherished by MS, MS will have the power to create new incompatibilities.
Swallow the baits if you want. …
By the way: This is a user forum. You shouldn’t expect to influence the development this ways. If you want to request a feature, or to support a request by someone else, you need to search https://bugs.documentfoundation.org for related topics.
Once MS and Google have succeeeded to force everybody into their clouds and under their “services”, hooking will be cancelled, and engulfing will be the maxim.