Copying cell background format in formula

sharshra

Active Member
Joined
Mar 20, 2013
Messages
413
Office Version
  1. 365
I have few cells color coded in the source table. When these cells are referred in another table, I would like to get the same background format. Is that possible? Can the experts advise please?

Example - Few cells are color coded in the source table. When I refer these in the new table, it should get the same background color as that of source table.

Source table:
excel problems.xlsx
P
213
22d3
239
242
2554
267n
Sheet2


New table:
excel problems.xlsx
R
2154
229
232
247n
25ab
Sheet2
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
There are no built-in functions that retrieve cell fill color (or any other cell formatting). This can probably be done with VBA but the actual code depends entirely on a lot detail about what you are doing. What do you mean by "when I refer to these"? You are not showing any formulas.
 
Upvote 0
@6StringJazzer, thanks for the response. What I mean is - when I enter a number / character in the new table, if it matches with the source table, it should get the same background format (color, text style etc). I understand it is possible with VBA, but I was looking for getting the same result without using VBA.
 
Upvote 0
I was looking for getting the same result without using VBA.
The only way that would be possible is if the formatting in the first table is applied through Conditional Formatting and it is possible to apply the same Conditional Formatting to the second table.
 
Upvote 0
First table has no conditional formatting. It is received from a different source & I have no control on the formatting made. 2nd table also has no conditional formatting except that it should mimic the first table when numbers / characters in the 2nd table match the 1st table.
 
Upvote 0
In that case VBA is the only way.

To give you code that will actually work for your file I need the details about where is the first table (I assume it's really more than P21:P26), where is the second table. Are these just ranges, or are they structured tables? You didn't show much context.
 
Upvote 0
If using vba is going to be acceptable, we would also want to know if it is possible that in the first table the same value could occur more than once with different colours and, if so, how that should be handled in the second table.
 
Upvote 0
Thanks, @6StringJazzer & @Peter_SSs. You are right, I have shown the example for illustration only. They are in ranges. Not in tables.

It´s an interesting question about duplicate values having different format. I haven´t thought about it. So far, I haven´t come across any duplicates, but it is very much possible.

First, I would like to tackle the problem assuming that there will be no duplicates. As a second step, I have to think about handling the duplicates.
 
Upvote 0
Thanks, @6StringJazzer & @Peter_SSs. You are right, I have shown the example for illustration only. They are in ranges. Not in tables.

It´s an interesting question about duplicate values having different format. I haven´t thought about it. So far, I haven´t come across any duplicates, but it is very much possible.

First, I would like to tackle the problem assuming that there will be no duplicates. As a second step, I have to think about handling the duplicates.
Unfortunately that did not address this point raised by @6StringJazzer :
I need the details about where is the first table (I assume it's really more than P21:P26), where is the second table.

A further question: Are the values in the second range the result of formulas or are they being entered manually?
 
Upvote 0
I get the file from an external party. As mentioned before, I have no control on the conditional format done in the source file. And there is not much to be done with the source file. It is used only for reference. I hope this clarifies.

Values in the 2nd range is entered manually. When entered, if it matches with the values in the source file, it should mimic the format (background color, text style) of the source file.
 
Upvote 0

Forum statistics

Threads
1,225,729
Messages
6,186,692
Members
453,369
Latest member
positivemind

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