Change background or fill color of a cell in pandastable - colors

I am using pandastable to display a pandas dataframe. I would like to set the fill color or the background color of a cell based on the value. Is there a function I can call which takes row index, column index and color? BTW, when I right click on a cell in a displayed table, it gives me a menu to select a color, but it does not set the color of the cell. How is the selected color used?
Thank you.

Related

EXCEL - Shape color does not update

I am using the following VBA script to change the color of shape "Rectangle 56" when the color of cell "H31" is changed based on a conditional formatting.
ThisWorkbook.Sheets("Menu").Shapes("Rectangle 56").Fill.ForeColor.RGB = ThisWorkbook.Sheets("Menu").Range("H31").DisplayFormat.Interior.Color
The Shape only changes color if I double click the cell "H31" and press enter. Can someone provide an idea on how to change the Shape color automatically when the cell color has changed?

Conditional formatting with cell values based on their row

I'm currently doing a small side project where I'm converting images into excel spreadsheets. I have a python program which turns each cell into a range between 0 and 255 (RGB color codes).
I had made this a while back and don't actually remember how I colored each row with conditional formatting.
Essentially, I need to select each row, turn it a shade of red. Then I need to select each alternate row (MOD 2 = 0) and turn each of those into a shade of green. Finally, I need to select each third row (MOD 3 = 0) and turn those into a shade of blue.
Again, to reiterate, I'm having trouble with actually selecting the rows. Is there any way I can do this (without doing it by hand)?
Check the following:
Highlight rows to get formatted
Click on "Conditional Formatting" and then "New Rule"
Click the last option on the upper part of the box "Use a formula to determine which cells to format"
Type this =MOD(ROW(),1)=0
Click "Format" and select a fill color (Red in this example)
Repeat it two more time for the other two colors
=MOD(ROW(),2)=0 for Green & =MOD(ROW(),3)=0 for Blue
check the below image

Customize Conditional Formatting in Excel 2010

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

Excel 2010: Conditional Format Class Schedule based on Subject name

Excel 2010, creating a class schedule. Colour coded per class name.
I have a table, broken in to 10 min amounts.
7 wide, 30 down.
I want to conditionally format all cells that contain the letters ENG in green, all SCI in yellow & so on.
Currently my table colours end up with the top priority cell, rather than end up with a multi-coloured table.
In conditional formatting:
=$R$12="ENG"
=$R$11:$V$20,$R$25:$V$29,$R$34:$V$38 colour = Green
=$R$17="SCI"
=$R$11:$V$20,$R$25:$V$29,$R$34:$V$38 colour = Purple
I either get 'green' or 'purple', I don't get a table with both colours in their respective cells.
R12 = Green
R17 = Purple
U12 = Cyan (eventually) etc etc
I know I'm missing something, I don't know what though.
Thank you
Use relative references in your conditional formulas:
If the highlighted cell in your currently selected range is R12, edit the formula (with mouse and Backspace/Delete buttons, do not press arrow keys when editing the formula) to:
=R12="ENG"
...
(see also Excel vocabulary to find solutions faster for a little more background)
Also you don't have to use a formula for this use case, just choose an option Format only cells that contain > change bettween drop box to equal to > write ENG to the text box.

Is it possible to display a value based on presence of a cell border?

We are looking at doing some data import. There is a very large complex sheet which has some items grouped together using borders around cells in one column. The only indication that the items are grouped is the fact the group is surrounded by a border. Items ungrouped have no left and right border on the cell (may have top and bottom border as items above and below maybe grouped). As an initial exercise we want to add a column that displays true if an item is grouped. So if there is a border display a value like one. Does anyone know if this possible?
Use this custom VBA function:
Public Function GetBorder(ByVal Rng As Range, Idx As Integer) As Boolean
GetBorder = Rng.Borders(Idx).LineStyle <> xlNone
End Function
It takes two arguments: cell and index of border (7=left, 8=bottom, 9=top, 10=right). Returns TRUE or FALSE.
Now if you want to get info about bottom border of cell A1 you should:
=GetBorder(A1,8)

Resources