i have a table for product in power bi. It has a column called sales rate.it has a text value “high,medium,low”.i want to add a conditional formatting to it. If it is high,the background of a cell should be red.if it is medium, background of a cell should be yellow.otherwise it will be green. How i can do it? And is it possible to use switch function with text?
You can make a new column, like this:
Column = SWITCH('Table'[Sales rate]; "high"; "red"; "medium"; "yellow"; "low"; "green")
Then right click each of the fields in Visualizations pane and select Conditional formatting -> Background color:
Format it by Field value, based on the column made, with First summarization, and you will get the highlighting you want:
See Use conditional formatting in tables for more information.
Related
I don’t want to use conditional formatting because I need a different value as the text in the cell (not what the color values apply to).
Column E is status (at risk/on track/needs improvement)
Column I is trend, displayed as arrows (Unicode text)
Column J is blank
I would like the color of the corresponding cells to be based on Column E text “Needs Improvement” in red, “At Risk” in yellow, and “On Track” in green.
So - in J2 through J13, I need the color only from the E2:E13 status and the trend arrows from I2:I13
I know this has been asked before in one way or another, but I can’t figure out the conditional formatting in VBA for some reason. Im sorry
Conditional formatting doesn’t work, I was trying to pull conditional colors from column E, but the only code I could get to work couldn’t integrate conditional formatting colors (it had to be true cell colors)
Below are the 4 sets of conditional formatting I used to accomplish the below example. I did not know what your trend data looks like so you'll need to adjust that to fit. To note, the formula in column J is ["=I" & row], so it's pulling over the same values. Those are hidden with the icon formatting. ::
Where RG = range("J2:J18")
Colour:="Red" while [=$E2="At Risk"]
Colour:="Yellow" while [=$E2="Needs Improvement"]
Colour:="Green" while [=$E2="On Track"]
Shape:="Icon Set" [checkmark] Show Icon Only
Example of formatting:
Example of result:
Let me know if any of that doesn't make sense.
I am trying to add conditional formatting on my pivot table created from Epplus bu i am not able to do it.
I can add the column colors on regular excel sheet by
using (var range = Pws.Cells[1,1,5,5])
{
range.Style.Fill.PatternType = ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(colorValue);
}
But when i add the code on pivot table sheet and try to open it it gives a pop up message like "Do you want to replace the content of the destination cell in PivotTable?"
I think its adding the color on top of the pivot table value. Its my guess because i can see the value of pivot table when i dont add the color formatting.
Any one had this issue and is there any work around?
I'm unable to create a rule in Conditional Formatting for this requirement. I was tried using this option "Use a formula to determine which cells to format" inside the rule but didnt get proper formulae.
My Requirement:
If I change the Activity value to Completed in column A then accordingly the font color should be in (Sky blue) and font size is (10) in columns B and C.
If I change the activity value to Delayed in column A then the font color should be in (Red) and font size is (Default or no change) in columns B and C.
Also if I manually type to change the Activity type from To Do to Completed then the Final Date column field value should be automatically filled with the current or Today's date which is as on date.
What formulae I can use for this requirement? How?
Changing the text format is easy to solve with Conditional Formatting, changing the cell's text to today's date requires VBA.
1. Text format
Select cells B2:C10
Create a conditional format with "Use a formula to determine which cells to format". Enter this formula:
=$A2="Completed"
Click the 'Format' button and apply the blue text color and your desired font size.
Repeat the steps using this formula:
=$A2="Delayed"
Apply the red font color.
2. Enter today's date via VBA
Open the VBA editor with Alt+F11
Double click the worksheet on the left hand panel where your Activity table is placed (i.e. Sheet1).
Enter this code in the right hand code panel:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Value2 = "Completed" Then
Cells(Target.Row, 3).Value = Date
End If
End Sub
I have two columns in an excel worksheet. I want to filter where the two columns are different. Any advice?
or even more simply put this in the third column
=A1=B1
You could add a calculated column like =A2=B2 and filter for FALSE on that column.
Here's an alternative that only requires formatting the differences...
1) Select the two columns you want to compare and press [Ctrl+\] (or goto special|row differences). If you want to remove the column heading from the selection press [Ctrl+Shift+\] (or goto special|column differences). See example below
2) Format the selected cells with a font color then right-click the selected cell and choose Filter > Filter by selected cell's font color:
Put this in a third column
=if(A1=B1,1,0)
filter where that thridcolumn=0
Is it possible to clear a large number of cells contents based on color alone? I don't think that simply filtering is going to work well on this because the dataset is large and 'wide'
If you don't need this done programatically, it can be faster to just use Find and Replace (Ctrl-H).
Press Ctrl-H
Click Options > >
Click the top Format... button to search for for colored cells (use the Fill tab)
Leave the Replace with field blank to delete the contents of cells with the format you specified.
This will clear the content of any cell within the range A1:G8 filled with yellow (65535). Change the color for your color and the range for your range. This is kind of crude, sorry.
Sub Macro1()
Range("A1:G8").Select
For Each Cell In Selection
If Cell.Interior.Color = Excel.XlRgbColor.rgbYellow Then
Cell.Clear
End If
Next
End Sub
You can clear cells by background color using Excel's filter options.
For Excel 2013 & 2010
Open a worksheet where each column has a header row.
Enable column filtering with Data -> Sort & Filter -> Filter
Click the drop-down-arrow on a column, go to Filter by Color, and select a color you want to view. (Any non-colored cells will be hidden)
Select the remaining cells, right-click and select Clear Contents.
To unhide the remaining cells, disable column filtering with Data -> Sort & Filter -> Filter