In Excel increment a gradient colour based on cell value - excel

How can I increment the gradient colour to match a value given in a cell.
This is a mock up using cells to show the output I want.
What happens when using gradients that the length of the line shrinks but all the gradient colour stops remain. How can I stop the gradients at the colours based on value.
This is a bar chart with gradients as you can see the line length changes but all colour stops still show.

Apply formulas right next to the question rating and then do conditional formatting as per my screenshot.
The formula is to fill the cells with value 1 or 0 , so if you have 1 in the cell it should be colored otherwise no fill.

Similar one to Imran's solution but with following changes,
A different formula for validation
Use of Excel Tables so that you can add / remove rows and keep the conditional formatting range dynamic
Once you have the initial data set ready please convert the data range including the columns for color fill to an Excel Table (Select the entire range including headers -> press Ctrl + T (OR) Click on 'Insert' Tab in Ribbon -> Under 'Tables' section click on 'Table')
Once you get your data set converted to an excel Table select the column range (here B2: B4) within the table for applying 'RED' fill
Shortcut: Select any cell in the column B within the table and press Ctrl + <Space Key>)
Goto Conditional Formatting -> New Rule -> Use a formula to determine which cells to format
RED =COLUMN(B$2)-COLUMN($B2)+1<=$A2
Click 'OK' and hit 'Apply'
Repeat the same for remaining 4 columns with the below formulas,
ORANGE =COLUMN(C$2)-COLUMN($B2)+1<=$A2
AMBER =COLUMN(D$2)-COLUMN($B2)+1<=$A2
L GREEN =COLUMN(E$2)-COLUMN($B2)+1<=$A2
D GREEN =COLUMN(F$2)-COLUMN($B2)+1<=$A2
Here is the screenshot showing the formula used,
The conditional formatting range will automatically expand / contract when rows are added / deleted.
Cheers !

Related

Excel VBA loop through Conditional Formatting

I am seeking help with a conditional formatting VBA code.
What I am basically looking for is to review each row starting from row “H2:Y2” and compare it with the “min” (F2) and “max” (G2) cells and highlight them as per the following conditions/colors:
If the value in the cell is between 0 and 50% of the min -> Red
If the value in the cell is between 50% and the min -> Yellow
If the value in the cell is between the min and the max -> Green
If the value in the cell is above the max -> brown
The program should stop once it has reviewed all rows/columns with a value.
Thanks a lot in advance!
Best,
Ugo.
Example without the use of VBA:
Select H2 and create 4 new cond. formatting rules by formula:
=H2>($G2) For brown
=AND(H2<=$G2,H2>=$F2) For green
=AND(H2<$F2,H2>=$F2/2) For yellow
=H2<($F2/2) For red
Then you copy H2, select the entire range that you want to apply the cond. formatting on, right click, and select paste formatting. (Or just edit the range in the managing tab for the conditional formatting)
Done.
The trick is to get the $ right, which sets the reference as absolute. So H2in the formula has no $ so this will change as the formula moves.
The min/max columns have a $ in front of the column name, because we always want to look at that column. But none in front of the row number, as we want to go down the rows and use the min/max for those rows.

Changing Color of a column based on other column in put

I have a table that has Color and Progress Interval Columns, I wanted to change the cell color in Progress Interval Column based on cell in Color Column. Example if Cell D2 says Green, E2 will be filled with Green.
Snap Shot From Table
Conditional Formatting
If Progress Interval is in column E, select the range from E2 to the last cell e.g. E20 and go to Format >> Conditional Formatting
choose Formula is and copy/paste the following formula:
=D2="Green"
Now click Format and click on the Patterns tab and choose the green color you need and change anything else (Font, Border). When done click OK.
Now you can click Add to add another condition and do the same for Yellow. When finished click OK.
If you want to exclude cells that contain no data use:
=AND(E2<>"",D2="Green")
Now only cells in the E column containing data will be hightlighted.

Excel formula formatting

is it possible to use a formula in conditional formatting to change the fill color of one cell based on the fill color of another cell. All I can find is value based formatting. I have a large sheet that has many rows in one color with nothing in the cell and I want to change those cells to another color without having to select them.
You could use the Excel 4.0 Macro Function GET.CELL:
Returns information about the formatting, location, or contents of a
cell. Use GET.CELL in a macro whose behavior is determined by the
status of a particular cell.
Syntax
GET.CELL(type_num, reference)
type_num = 39:
Shade background color as a number in the range 1 to 56. If color is automatic, returns 0.
With cell B1 selected create a named range called FillColour.
This refers to: =GET.CELL(38,A1)
Now, if you enter the formula =FillColour in cell B1 it will show a different value when you change the background colour of cell A1.
NB: You may have to manually force a recalculation for it to work.
Next add conditional formatting rules: =FillColour=29 will be TRUE if the cell to the left of the CF is formatted as purple (RGB: 177, 160, 199).

Relative Reference in conditional formatting

I want to highlight cell D2 Red colored if value in E2 is between 0 to 10 and if the value is 11 to 20 than yellow color and if >20 than no color. Please help somebody is this possible? and how to do this?
select all of columns D&E (eg by clicking on column headers, with Shift)
click conditional formatting -> new rule -> use formula to determine which cells to format
in the formula box type : =AND($E1>0,$E1<=10)
set fill to red, click OK
-
select all of columns D&E (eg by clicking on column headers, with Shift)
click conditional formatting -> new rule -> use formula to determine which cells to format
in the formula box type : =AND($E1>10,$E1<=20)
set fill to yellow, click OK

Ms Excel Conditional Formt Text Ranges

How do I automatically have excel color code the cells in my table, to the legend I have in column I based on the text values? Is there a formula I can use to do this as I do know VB. I don't mind entering a new rule for each color as long as it pulls the correct text in column I and matches it to the table.
Table = Cells B2:F13 containing all text values
Column I2:I5 = text "YELLOW,PINK,PURPLE,BLUE" Fill color to be Yellow
Column I7:I10 = text "GREY,TAN,TEAL,MUSTARD" Fill color to be Green
Column I12:I14 = text "GREEN,ORANGE,RED" Fill color to be Orange
First select cell B2. In the Conditional Formatting Rules you will need to make 3 rules, one for each fill color. Select the 'Use a formula to determine which cells to format' option. Now we will use Excel's formulas to determine if the text matches the legend. Enter the following formula into the conditional format for B2:
=IFERROR(MATCH(B2,$I$2:$I$5,0),0)>0
That is the code for matching to the Yellow, Pink, Purple, and Blue keywords. This takes the value in the cell it applies to and looks for it in the legend referenced, if the match function finds the text it returns the location in the array, a non-zero number. If match doesn't find a match it throws an error, which we catch with the iferror function which converts it into a 0. Finally, we compare our result to 0 which gives us the true/false that the conditional format needs.
Note that the first reference B2 is relative while the match array reference is absolute. This way when we expand the conditional format to cover the whole area it updates the reference to apply to each cell, but not the reference to our legend.
For the other 2 colors simply adjust the match array to the other references.
Then the final step is to go into the conditional formatting rules manager and adjust the 'applies to' range to the full range instead of just B2.

Resources