I have a conditional format in Excel that is displaying the up/down arrows based on certain values. This works just fine. However, in my spreadsheet (which is largely controlled by VBA) the user has the ability to review data in a 'grade' display (L=1,M=3,H=5) rather than the 1/3/5 score. I have a custom function that can convert the L/M/H to a number, but I can't figure out how to incorporate this into the conditional format. I can do it in a normal conditional format, but I want the up/down arrows icon set. I'd remove the conditional formatting and apply an icon to the cell with VBA but I don't think that's possible. Any help?
You could either:
Mimic Conditional Formatting
Forget conditional formatting and use excel 2003 type methods with arrows and Wingdings font. Looks very similar, Andy Pope has a good example:Mimic 2007 Conditional Formatting Icon
Use an invisible helper column
The hidden helper column will display the numeric values 1,3,5 based on the actual cells L,M,H. Then in the cell with the L,M,H, you add the conditional and set it to the value of the helper column.
What I ended up doing was adding an additional cell to the right that used a UDF to convert the cell values to numbers. I then applied the conditional formatting to this new cell and set it to to display the icon only. By locking the icon cell and protecting the worksheet (was going to protect anyways) the field is never user editable which is exactly what I wanted.
Related
I have a set of rates I have applied conditional formatting to in excel 2016, see screenshot below:
On top of this, I also have a conditional format that formats blank cells as gray.
While these are rates, additionally I would like to mask rates in cases where their denominator is below 10 and replace the displayed value with "I" to indicate insufficient data, but still keep the original conditional formatted color displayed. Is there an efficient way to do this in excel 2016?
There is a simple workaround I discovered with the help of my coworkers.
Take the table with conditional formatting in Excel
Copy it all
Open up a blank Microsoft Word document
Paste the Excel table into Microsoft Word
Select the whole table in Word and copy it
Paste the table from Word back into Excel
The formatting might look a little clunky at first, but my conditional formatting was then locked in as the format and no longer conditional. This worked for my purposes; I was then able to apply additional conditional formatting on top of this table without issue.
I noticed that if I format (font, color, etc.) a certain number of cells in a row or in a column, as soon as I type text in adjacent cells in the same row or column formatting is automatically applied to the added cell. How can this automatic behavior be stopped? I'm formatting cells programmatically and style/color if often defined conditionally, it is not simply to please the eye or to make data more readable and excel's automatic formatting is setting formatting/color without knowledge of the underlying logic. Formatting is not being set via formulas but via C# code.
This is controlled by a setting of the Excel Application Object:
YourExcelObjectReference.Application.ExtendList = False
I have some cells with some different filling colors.I want to do the following thing: I want to use those colors in conditional formatting rules, so when I change the color of a cell, the conditional formatting color will change too.
Like in this image
In the screenshot above, there is a zone called "Legendă". So when I change the color of a cell there, the others cells with the same color will change too. The other cells have conditional formatting rule.
In general, formatting is not considered source data in Excel. The workaround, then, is to put the information in a new column.
Say you were formatting column B and wanted those colors to modify formatting elsewhere. The idea is to create another column and add your data there, and then create a conditional formatting formula for column B (and any other columns) that refers to your new data. This way, you can get as many columns as you want to respond appropriately.
I want to modify the colors of some cells in an already filled Excel spreadsheet using the method:
FlexCel.Adapter.XlsFile.SetCellFormat(int row1, int col1, int row2, int col2, int XF);
The colors are not always correctly displayed since the cells I modify are sometimes subject to Conditional Formatting rules that override background and foreground colors.
In Excel, there is a functionality to prevent a rule from being applied on a specific cell.
Is there such a functionality in Flexcel?
What is FlexCel? You may want to provide a link to this tool or describe what it does.
In general, direct cell formatting and conditional formatting are two different things.
You can apply a cell format (and I assume that FlexCel is an add-in that uses VBA to set the cell format) and the cell will show it.
Conditional formatting will override any direct cell formatting if the condition is met. It does not matter how the original cell format was arrived at. Whether or not the cell has been formatted manually or with a VBA routine or an add-in like FlexCel is insubstantial.
From the code snippet you posted it is apparent that the cell format is set with VBA. If a conditional format is applied to the cell, that will override the format applied by VBA.
If you don't want that, you will need to extend the VBA code to include/exclude your specific conditions instead of using conditional formats.
I have searched for this solution and I have found many drop-down lists that can change the color and the data of the cell or change the color depending on what data is entered.
What I would like to do is have a cell with a number inside (#'s 1-10) and also have a drop-down list (pass, fail, marginal) and depending on which item from the drop-down list is selected it would change the cell's background color to red, green, or yellow, from it's default of white.
Any help would be appreciated. Thanks!
You can use conditional formatting to achieve the same. For the cells with numbers add conditional formatting
Home -> Conditional formatting -> New Rule
Select Use a formula to determine which cells to format. Now you set a formula here. You can refer to drop-down list value here to set format. (eg: if column A has numbers and column B has the drop-down, you can set the formula as =$B1="Marginal" and set the formatting.
Hope this helps.
Screenshots for reference:
I think I've found the best solution for this situation:
I had two cells side by side. One with the data and one with the drop-down box. The two cells bordered together so that they appear as one cell (even though they aren't). I then put two separate conditional formats on the two cells. The conditional format of the data cell changed the background color of the cell based on the value of the drop-down box cell. The conditional format of the drop-down box cell changed the background and text color to the same color as the other cell (to blend in) depending on its own value.
When the two cells were bordered and spaced correctly they appear as being one cell with one value. Quite a bit of work with the formatting and all but I think this may be the best option for this situation.
Thanks again, Konstant for your help. :)