Conditional Formatting issue - alternative implementation? - excel

I am having a problem with malfunctioning conditional formatting in Excel 2010, whereby "traffic lights" occasionally have the wrong color. I have several KPIs, with the same "traffic light"-style conditional formatting applied across the cell range: most traffic lights are correct, but some aren't. Monkeying around with, for example, clearing the cell's format and either re-defining it, or copying the format from a different cell, typically helps, but sometimes it does not, and then I am stuck and have to clear the cell's conditional formatting and paste ("hardcode") the appropriate traffic-light image onto it. Can anyone suggest a "traffic lights" implementation that does not depend on Excel's conditional formatting?

I was able to reproduce the apparent rogue behaviour you described and may have a solution for you.
                                                           Columns A correct; column C not-so-much
Column C has a three icon Conditional Format rule as you described using 100 and 75 as the Value and Percentage as the Type. Column A (which appears to work correctly) uses 1 and 0.75 as the Value and Number as the Type.
                                  Raw numerical values instead of percentages in Value text box(es)
So it would appear that Excel 2007 does not handle converting percentages within Conditional Formatting as well as it should.
You shouldn't have to change the display of the values within your worksheet. Just modify the conditional format rules to use the underlying values of your percentages and Number in place of Percentage as the Type.
Delving a little deeper into this showed that using 100% and 75% (as opposed to 100 and 75 sans % symbol) for the Value(s)s while maintaining Percentage as the Type will get Excel to change these on-the-fly to 1 and 0.75 when you leave the corresponding Value text box while retaining Percentage as the Type. This seems contradictory to me, but it does provide the correct green-yellow-red traffic light behaviour.

Related

Alternating Color of Rows with Merged Rows in Leading Column - Excel 2016

I'm trying to create an Excel sheet that will be tracking some of our autonomous processes and their access privileges at my company and I've run into an issue with Excel..
I'm trying to alternate row colors, which in and of itself isn't an issue, however the fact that I've got merged rows are giving me issues.
As of right now I've got 5 columns with headers in A through E. Column F is being used for conditional formatting to color the rows. In column F this formula is present:
=MOD(IF(ROW()=2,0,IF(A2=A1,F1, F1+1)), 2)
This works great if I want to repeat the leading Column item over and over, however I'd like to reduce the visual clutter and increase clarity, so I've merged some of the rows in the Column A because multiple rows in B:E correspond to it.
I've merged A2:A4 right now and the formula picks up the A2 and A4 as blank, but A3 (the text in the merged cell is centered) is recognized as different that A2 and A4 because the text resides there. I'll upload an image to give a better idea of what I'm talking about as well.
If anyone can give me a tip on how to alternate row colors with merged cells/rows that'd be great, I've done a lot of googling and searching on stackoverflow, but for the most part I've only found things that pertain to unmerged rows/cells.
Image Example: https://imgur.com/a/UDbRVWA
=IF() Condition that worked for me:
=MOD(IF(ROW()=2,0,IF((A2=0),IF((OR(A1<>0,A2=A1)),F1, F1+1),F1+1)), 2)
There is an answer below with a picture I posted, however, for most situations I would recommend the method suggested by #BruceWayne. It's far more sensible than working with merged cells!
I ended up finding a solution with just some clever working with the Conditional IF() statements. I think the key was taking into account that the Merged Cells that weren't the top (i.e. If I merged A2:A4, A2 is top, A3, A4 bottom) were equal to 0 while the top was set to the value of the text within the merged cell. Using the formula below I was able to achieve the result I was after:
=MOD(IF(ROW()=2,0,IF((A2=0),IF((OR(A1<>0,A2=A1)),F1, F1+1),F1+1)), 2)
And here is a linked screenshot: https://imgur.com/a/gNaC62c
I then just added conditional formatting for every row but row 1: =$F2=1. I'll be hiding column F to make it seem less obtrusive.
For future reference, I would agree with what #BruceWayne mentioned in that a simpler formatting that gets the job done would be preferable. There are many other ways to format this in a way that makes much more sense, but I felt like I was close when I was tinkering with it, so I stuck with it another 15 minutes or so and was able to pull out a usable formatting condition.
Might I make a suggestion? If the merging rows is to increase clarity with repeated entries, perhaps we can use another Conditional Formatting rule to make it more legible.
Say you have data that looks like this:
But, we don't want to see <Process #> duplicates in the A column. We could merge these cells and center it along the rows. But again, merging cells is generally frowned upon I've found. (It makes it tricky to format, conditional format, copy/paste, do any VLOOKUP()/Index/Match, etc.)
First, let's get the rows alternating colors. I'm using fill of RGB(183, 255, 253):
New Rule 1 -
Formula: =MOD(ROW(),2)
Applies To Range: $A$2:$E$9
Format: Fill with color RGB 183, 255, 253 (...or whatever you want, just note the RGB for later)
Now, we get this:
Okay, making progress. Now, let's work on hiding the duplicate values in column A.
So, let's apply some more Conditional Formats. We'll need two for column A, one to set the font to White, one to set the Font to that blue fill color.
New Rule 2 -
Formula: =AND($A3=$A2,MOD(ROW(),2)=1)
Applies To: =$A$3:$A$100
Format: Font --> Color --> RGB(183, 255, 253)
New Rule 3 -
Formula: =AND($A3=$A2,MOD(ROW(),2)=0)
Applies To: =$A$3:$A$100
Format: Font --> Color --> White
Now we have:
IMO, we can do one more thing to clarify the breaks in Processes:
New Rule 4 -
Formula: =$A2<>$A1
Applies To: =$A$2:$E$100
Format: Border --> Top Border
Now, we have a nice new CF table.

Complex Conditional Formatting Scenario

Thank you in advance for whatever help you may be able to provide.
Purpose/Scope
Analyzing the effectiveness of retail store renovations and relocations.
Existing Material
I have many slices or views, but let's assume there is only one.
The back-end looks like this. Please note that empty cells will still have a formula in them as they are being populated from a data dump.
Back-End
The front-end looks like this and is populated with an 'Averageifs' formula, simplified example is below. "CompStores" is a named data range.
=IFERROR(AVERAGEIFS(CompStores[Growth Year 2],CompStores[Action],$A1),"")
Front-End
Just for clarity, the counting table (if needed) would look like this. Hopefully this project will not need a counting table, especially considering switching "averageifs" to "countifs" cannot easily be done by a search+replace because countifs has less arguments.
Counts
The Task
• Highlight each cell in the front-end based on how many observations there are with the purpose of knowing how confident we are in that growth %.
• The counting system I would like to use in real life is under 5 observations = red, 5 to 9 = yellow, 10 or above = green.
Here is an example output based on the count and colours I will use in real life.
Sample Output
Please help me, I really don't want to have to do this by hand lol. Thanks to anyone who even attempts to help!!!
Whenever I have several conditions for conditional formatting, I always prefer to non-conditionally (permanently) format the cells with the most complicated condition and then use subsequent conditional formatting rules to "override" the base formatting.
In this case, since yellow is the most complicated condition (since yellow falls within a range and has two bounds, as opposed to red and green which just have a single bound), I permanently formatted the entire range (B2:E3) as yellow and then made two conditional formatting rules (one for red and one for green) to override the yellow base formatting.
See below screenshots of simplified versions of your data.

Excel 2016: Adding Gradient Formats for Cell Background and Font?

I'm using Microsoft Excel 2016 to construct a forecast model with a range of outputs. I have used Excel's built-in Conditional Formatting setting (Graded Color Scale, to be precise) to make the outputs visually informative, setting a green gradient scale to distinguish between low-valued outputs and high-valued outputs.
The minimum-valued cell background is set to 'Green, Accent 6, Lighter 80%' and the maximum-valued cell background is set to 'Green, Accent 6'. This has worked well. The cell values near the maximum, however, can sometimes be difficult to read, since they are 'Black, Text 1' (not a great contrast with the darker Green).
I am hoping to add the same type of conditional formatting to the cell texts in the range of outputs to generate a color contrast: for example, in the lighter end of the gradient, the cell texts will be 'Black, Text', and in the darker end of the gradient, the cells texts will be 'White, Background.' Visually, that would solve my contrast issue.
Unfortunately, after reading through this forum and searching for conditional formatting guides on Google, I haven't found a solution on how to apply the two types of formatting (background and font) to the same range of cells. I am not practiced in VBA, so I am hoping for any pointer that involves Excel's native functionality, if that's possible.
To boil all this down into a one-liner: "How do I add gradient conditional formatting to both font and background to a range of cells?"
Thank you for the help!
I have done this in the past by creating a number of rules that give the appearance of a gradient on both. To do this however you would create as many rules you need to get the resolution you want. For example:
Suppose you want to assign font and background fill for each value in increments of 10% from 0 to 100%.
For this you need to get 10 font colors in rgb format that gradually shift in the gradient that you want here is a site that can help:
http://www.colorizer.org/
Then do the same with for you background colors.
Now pair a font and background color with the range that you want that rule to apply to and write the excel rule.
While this method is a pain to set up it avoids vba at all costs and if you use the sheet as a template for other sheets you won't have to mess with it much.
Creating your own sets of custom rules as per #rahicks answer in the most comprehensive way of doing this. If you have a fairly stable range of values, then a quick and dirty solution is to use Custom Number Formats.
On top of your current conditional formatting, apply a Custom Number Format using a condition. This example sets the colour to white if the value is greater than 50, and then uses the existing colour otherwise.
[White][>50]General;General
You'll need to replace 50 with the mid-point of your data range and you'll also need to replace both instances of General with whatever number format you currently have on the range.

Discrepancy between results of EXACT function and Conditional Formatting

I'm observing an apparent discrepancy between the results of the EXACT function and the conditional formatting tool.
Two cells in Column B have the same apparent text (about 30-40 words). But the "highlight cells" tool doesn't recognize them as duplicate values. Comparing the two cells with the EXACT function returns TRUE, however. This also occurs when comparing the results of the CLEAN function applied to both cells. The cells include characters like "//" and square brackets (although why that should be a problem I don't know, especially since other such cell are correctly identified as duplicates by conditional formatting tool).
Can anyone suggest why this might be happening?
An example, obfuscated with U=uppercase, x=lowercase and d=digit:
(U//FOUO) UUUU-U Increment d shall comply with current UUUxxx and UUUU Meta Data Repository (MDR) commercial, DoD, and Intelligence Community (IC) metadata standards and shall have a xxxx-xxxxxxxx controlled metadata tagging capability to tag all messages, products, and data files that are posted to the network (MRIC=Objective). [0014] [Interoperability]
It seems there is a 255 character limit to the Conditional Formatting, Highlight Cells Rules..., Duplicate Values... rule. To me plausible since consistent with the limit for characters in a formula in VBA.
A simple way to check is to apply such a rule to both the column with your data and to an inserted adjacent column (say C) populated with a formula such as:
=LEFT(B1,255)
That I expect to highlight the extracted characters. Then change the formula to =LEFT(B1,256) and I expect the formatting to disappear.
If so, you might insert another column (say D) populated with =RIGHT(B1,255) and, assuming your data is less than 510 characters per cell, you may have a workaround for detecting duplicates by applying the rule to ColumnsC:D.

Chart doesn't keep data label number formattng

I am having a problem with my data label formatting within an excel chart. As can be seen in the image below, the chart isn't retaining the number formatting I have set in the columns B and C.
I have used conditional formatting to make it so that if a number is below 0.01 it is displayed as a scientific e.g. 5.E-05 to 2 DP. And I've also got another rule that keeps all the numbers to 2DP if they are over 0.01.
I've already tried to link the formatting back to the sources of the cells but it gives me the same results e.g. Format Data Labels >> Number >> Linked to source (ticked).
The reason I do not do this manually is because its part of a python automation project, and it would also defeat the object of my conditional formatting.
I've already seen the solution for this question but the answer was to manual change it and again wouldn't allow me to use my conditional formatting.
Excel Chart doesn't keep format
See link for image below.
https://www.dropbox.com/s/45gmvtjqgd0y8e0/thing.png
Thanks in advance
Instead of using Conditional Formatting you can use custom number formatting which should flow through to the chart.
Select cells you want to format
Right Click > Format Cells
On the Number tab, select Custom
In the Type: field enter the following
[<0.01]0.E+00;0.00
This will format anything less than .01 as Scientific, and anything else by a number with 2 decimal points.

Resources