# Color-coding percentages, how should I interpret a result of 0/0 (as 0% or as 100%)?

I am making a report that requires me to display some calculations as a percentage. Basically, I'm doing a database query for records matching a specific ID. The number returned becomes my denominator for my calculation. Of this set of records, the number that meet a second condition becomes my numerator.

Obviously, if no records are returned in the first query, then I'll have a denominator of 0, which inevitably leads to a Divide-by-Zero error if I try to calculate a percentage out of this. As of right now, I have my function checking if the denominator is zero, and if true, I return a value of "0%" for this calculation.

Normally, I'd be satisfied with 0/0 = 0% since nothing is being calculated, so "nothing" should be returned. The problem is introduced when I have to color code the output based on the percentage. Suddenly I'm seeing a lot of red(0%) or a lot of green(100%) results, depending on how I grade 0/0.

Should somebody quickly glance at my list of percentages, they'll see "Oh, everything is green. Ok, good." Or they'll see "Oh no, everything is red. This isn't good."

This report is going to be a summary of my department's resources. It will be read by many heads of departments and such who don't care about specifics and just want a summary of my division. They have asked for percentages specifically, color-coded to red = 0%, green = 100%, and anything in-between shown as some combination of those colors. If they see a lot of red, that can have bad implications towards our department. If they see a lot of false greens, that could turn out worse.

I showing the actual percentage along with the fraction I'm using, but I'm afraid that they might simply glance at the report and only see the colors.

What is the most understandable way to display these results?

• Could you be more specific about those two conditions and could you describe what your report should express? It really depends on the context. Instead of green or red you could also use gray. – bodo Feb 6 '14 at 22:26
• I'm showing how many "books" are "best-sellers," separated by "author". If I initially search for "all books" and find none, what is the percentage of the "books" that are "best-sellers"? This would equate to 0 best sellers / 0 books. But thanks! I really like the idea of a neutral grey color. I hadn't thought of that. – cNovak Feb 6 '14 at 22:34
• In my opinion you need to give us more information regarding the users goals here. What are they trying to achieve? – René Rasmussen Feb 7 '14 at 8:26
• Sorry for the lack of details. The report I'm creating is going to be a summary of my department's resources. This report is going to a lot of higher-ups in the company and they want to see percentages (probably because they wouldn't understand more details). They have an existing color-code system they want to see in this report summary that correlates red to 0% and green to 100%. Everything in the middle is some combination of those colors, going through the yellow spectrum. – cNovak Feb 7 '14 at 19:27

I'd say for `0/0` you should use `N/A` that has been color-coded green to match the `100%` items.

Due to the fact that `0/0` is not `100%`, I would try to avoid implying that it is at all costs.

• @CharlesWesley - While I agree, I think the issue is more with the question that requests opinions: `I was wondering if anyone had an opinion on how I should display these results?` – Code Maverick Feb 6 '14 at 22:42
• @CodeMaverick A valid point--edited the question to remove the request for opinions. If you can think of a better way to word that feel free to improve upon my edit! – Charles Wesley Feb 6 '14 at 22:47
• @CharlesWesley - Ah, I see. thanks for the welcome and the advice. Will keep that in mind. – TheMusiKid Feb 6 '14 at 23:57
• @TheMusiKid - I like this answer, but something keeps bugging me. You say you would avoid implying that `0/0` is `100%` at all costs, yet you are saying that the `0/0` should be `N/A` and color-coded green to match the `100%` items. Doesn't color-coding `N/A` items green to match the `100%` items do exactly that? Green would imply equality. What if you color-coded `N/A` items to a neutral color like a shade of black (gray)? That would show the user it's not equal to `100%` items. – Code Maverick Feb 7 '14 at 21:01
• @CodeMaverick - That's a good point; I wasn't sure if he was considering having a strictly binary color scheme. Having `N/A` colored a more neutral color does make more sense. – TheMusiKid Feb 7 '14 at 23:58

Showing a percentage seems odd to me, is that a number they care about?

Complex search logic can cause users to be confused about what you are even calculating. It is often helpful to show number of results that meet your AND criteria yet also show the individual results for each individual criteria. E.g. Books (50) > Bestsellers (5) > Fiction (0). This shows that 50 books met your main criteria, 5 then met your bestsellers criteria, and then 0 met your fiction criteria. You could then allow the user to click on any of the sections in the breadcrumb to instantly broaden their search criteria without having to edit their entries. I see that fiction caused my search to be too restrictive so I'm happy to just see those 5 Bestsellers at least.

• This report is being sent to many of the higher-ups in my company. The people who will read it want a small summary of our data, and they specifically want a percentage. – cNovak Feb 7 '14 at 19:23
• Interesting. A couple of thoughts. 0% represents an empty set really, right? I'd actually separate those out because they don't represent a low number but rather an area that you're company is not serving at all. Can you break out those 0% as a separate piece? It really depends on the story you want to tell. But it seems to me that red should equate to low penetration 5% for example, not an empty set which could simply use gray or a - to show another layer of data. – Mark Sloan Feb 7 '14 at 22:44

The answer depends on the meaning of the text or idea on the page.

If you are saying something like "The number of books from this author represents xx% of our catalog", then 0% is right. If you are saying something like "This number (0) is the totality (100%) of books from this author available from us at this moment", then 100% is right.

Those examples are just that, examples, quickly worded (and not the best), but the idea is that it depends on how are you presenting those results. Do you have a screenshot or similar that can improve your question?

I think your problem stems from the fact, that a green-red colour range might not be the best idea to begin with. Red would indicate that there is something wrong with an author. But I think the data you want to highlight is rather, which author is doing particularly well.

So you should instead choose different saturations of a single colour (green, if you like). Then you can use the minimal saturation for the case `0/0`, because there are no best-sellers at all.

You could also consider not showing the authors without books and maybe giving the user a possibility to reveal them, when the information is actually needed.