Conditional gradient formatting per row

50ld13r

New Member
Joined
Dec 27, 2007
Messages
44
HI,

I want to do gradient formatting across the row for each row in my dataset. I have about 1000 rows so don't want to be going crazy with the format painter. It looks like I cant use relative references in the min/max formulas so was wondering how to do it. Ideally I want to avoid helper cells and VBA. Seems that it should be simple but cant figure it out.

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi.
My apologies but I'm not sure I understand what you mean about relative referencing not being possible in the min/max formulas - do you have an example of the formula you're trying to use? I came up with the following example, where: (a) gradients are used in conditional formatting; and (b) the formatting applies to the cell that references the highest or lowest values in column C, relative to its row. I've used two CF expressions, but they use the same formula.

I have included the XL2BB excerpt below for your reference - you will see that the gradient formatting didn't copy across, so I include a screen capture too. Is that kind of what you were looking for?

1618507246714.png




Book3
CDE
320Num1
4154959Num2
560000Num3
6153524Num4
7140983Num5
8500000Num6
9128287Num7
Mr Excel
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E3:E9Expression=$C3=MIN($C$3:$C$9)textNO
E3:E9Expression=$C3=MAX($C$3:$C$9)textNO
 
Upvote 0
No problem thanks for giving it a go - i will try explain the problem a little better. Below is a sample of the data - I have 1000s of rows so don't want to be setting this up for each row. Ideally I would like to do it without helper columns or VBA.


Excel1.png


I tried using the following:

1618555302321.png


but got the error:
1618555324797.png
 
Upvote 0
Ahh, I understand now. I see the problem. I've not been confronted with this before, so let me think about it. Can I just ask, though, why is VBA off-the-table? Is it because you need to share the file with others and don't want to have to deal with macro security issues, etc? I ask because one solution may be (off the top of my head) getting VBA to make the condtional formatting rules for you. It could still be conditionally formatted, and the final workbook wouldn't need to have any VBA... it's just a thought.

I'm not sure it would work though, because i wonder how Excel would fare under the stress of having to process thousands of CF rules everytime a cell changed, etc...
As it is, Excel just will not play when you hit it's upper limit on the number of fonts you have in your workbook... I'can't imagine it would like limitless CF rules either...

I'll think about it. Someone else might have the solution off the top of their head, but I'll look into it this weekend in any event.
 
Upvote 0
Unfortunately I think you have no option but to do it row by row.
Either via the format painter, or via VBA to setup the CF rule on each row
 
Upvote 0
@Fluff - Thank you very much, Fluff. I figured that might be the case, but didn't want to throw in the towel too soon unless an MVP or some more experienced / knowledgable than me would be able to confirm one way or the other.

@50ld13r - I had a look into this and Fluff has confirmed above, that unfortunately - as you suspected - relative referencing won't work with colour scale conditional formatting. Depending on your needs, it seems as though your options are either: (a) use the format painter to manually apply the CF rule for one row to the rest of the rows on the spreadsheet; or (b) use VBA to undertake the task for you. I'm happy to help you with the latter if VBA is indeed a possibility.
 
Upvote 0
Thanks for investigating - It does seem bit of a missed opportunity in functionality. Unfortunately the report will be client side which do not enable macros to their end users. They update the report monthly and the data then remains static for that duration which covers just shy of 3k rows. Looks like the only way will be to use helper cells. Might have to be a rank to help flatten out the extremes.
 
Upvote 0
Sorry, I'm a bit confused - aren't you going to be applying the conditional formatting? Give me one second.
 
Upvote 0
Yes I am but will have to use a 16 helper columns that will show a rank of the % data. This will be used to apply the formatting to the percentages. Regardless of what the % value is for the highest value it will all have the same rank and thus all coloured the same - high to low.
 
Upvote 0
This is what you're after, is it not? I give you Exhibit A and Exhibit B. Both areas were originally populated by random numbers between 1 and 50, which I then adjusted to test whetehr the conditional formatting rules were working or not.

Exhibit A is non-referential. It started as a row for one rule, and then the scope of its application was expanded out across 12 columns and 18 rows. The consequence being that color scale is extended from between the lowest and highest values, wherever found in this 12x18 area.

I have highlighted four rows where I have intentionally warped the (otherwise random) values to give a series of 'extreme' values, but including within the row a clear high or low value relative to the other values in the row.

1618913647139.png
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top