Forum

Notifications
Clear all

Copying Conditional Formatting with Absolute References

19 Posts
3 Users
0 Reactions
245 Views
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

Hello,

I have rows using icons sets for the conditional formatting. The icon dialog boxes require a value or percentage. In my case, I'm using a simple formula to check if the value is greater than a row two rows above. Please see the attachment. If the formula evaluates to TRUE, then apply the rule. It works fine. But when I copy the formatting, whether by Format Painter or other means, the value field remains absolute, and points to the wrong column. When I try to change the field to a relative formula, Excel won't let me--it must be an absolute reference.

Microsoft online help says this:

"If you’ve used a formula in the rule that applies the conditional formatting, you might have to adjust relative and absolute references in the formula after pasting the conditional format."

That means I would have to adjust about 60 formulas, one by one. Is there a workaround for this problem?

Paul

 
Posted : 21/01/2017 6:15 pm
(@sunnykow)
Posts: 1417
Noble Member
 

There is no attachment.

 
Posted : 21/01/2017 7:48 pm
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

Oops! I've had problems uploading in certain formats. I copied a pic into an Excel file, and that should work.

 
Posted : 21/01/2017 8:51 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Can't read your binary file. Can you post in XLSX or XLSM instead?

 
Posted : 21/01/2017 9:21 pm
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

Okay.

 
Posted : 21/01/2017 9:26 pm
(@fravis)
Posts: 337
Reputable Member
 

Hi Paul, the .xlsx didn't work here but after I changed that file in .xlsb I saw the screenshot!

I'm afraid it's not possible to use relative references when using the Pictograms (Iconset). When I try to rebuild your case, there comes a message when I try to change absolute in relative that says that's not allowed when using color scales, something I can't translate so quick and iconsets.

So you have to find another workaround I'm afraid. It would help if you have a sample file so we can look with you and think with you which possibilities there are. You managed to sent two files so maybe also a 'normal' file with some of your data? 

 
Posted : 22/01/2017 10:32 am
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

I'm afraid you're right. Here's a sample file. Thanks.

 
Posted : 22/01/2017 3:14 pm
(@fravis)
Posts: 337
Reputable Member
 

Thanks for your example file Paul. Yes with this kind of Conditional Formatting you have to make the Conditions for every Column. I don't see another way, but maybe somebody else here does?

I think you understand that with other kinds of Conditional Formatting this is not the case?

I was thinking of a kind of 'workaround' with some helper columns, but can't make it working. Maybe later.

 
Posted : 22/01/2017 4:43 pm
(@fravis)
Posts: 337
Reputable Member
 

Maybe it's possible Paul, see attached file (if I can upload, this is my second third attempt, it has some problems (and now I save my text for next cases...) (AH you have to drag your file in, that works!)

In this example you see the following: I made first the conditional format in column F (without data in it). After that referred the content of the F column to the C column. That worked perfect. Then copied the F column to G and that is also OK!

So I think you maybe can do it this way: fill your data in all columns. Make one column which refers to the most left one and do there your conditional formatting and copy that column to the right as many times as necessary. Hide the original datacolumns after that.

Give it a try!

 
Posted : 22/01/2017 5:20 pm
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

Frans,

Thank you for working on this. I tried to duplicate what you did, above, but it wasn't successful. When I checked the cell reference it was still absolute, not relative.

 
Posted : 22/01/2017 6:04 pm
(@fravis)
Posts: 337
Reputable Member
 

Oh sorry, must admit you're right. In all the changing and copying I must have overlooked something. Sorry.

I'll look for another kind of workaround but that takes some more time. In the meantime you can fix your sheet by doing it by row, so it's finished 🙂

 
Posted : 23/01/2017 6:14 am
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Paul

As you already know, you can't change the formula to relative when using icon sets. You will need to change them one by one.

I would suggest you use helper columns with formulas and then format the columns using the icon sets.

I have attached an example for you.

Sunny

 
Posted : 23/01/2017 8:39 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Paul

I have written a macro for your specific needs. You will need to change some settings for the macro to run.

See the instructions in the attachment.

Please test on a copy of your data as the macro cannot be undone.

The macro will apply the CF to the selected cells and change the cell reference to the correct column and row but its address remain absolute.

Hope this helps.

Sunny

 
Posted : 24/01/2017 2:03 am
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

Thanks for the work you did on this. I went in to edit your macro, but I have no experience with VBA. My only ability with macros is Record a macro, but beyond that, nothing. I couldn't see where to edit rows or anything.

I tried several times to record my own macro, going through the dialog boxes in the Conditional formatting menu, but it wouldn't work properly.

 
Posted : 24/01/2017 5:37 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Paul

You will only need to change the number in red. 

RowToCompare = 3 'Change this number to the row number you want to compare against.

 

I have already set it to 3 to match your file.

3 is the row number you wanted to compare against. Change this number if needed.

Unfortunately you cannot record a macro to get the codes that I gave you. It must be coded manually.

Sunny

 
Posted : 24/01/2017 7:09 pm
Page 1 / 2
Share: