Formating cell colour based on a different cell's colour

FilleFrella44

New Member
Joined
Oct 11, 2022
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm wondering if you can change the colour of a cell based on the colour of another. The idea is to change the colour of one cell, then have several cells (which are seeds/children of the origional cell) to change to the same colour.

See below/attatched for desired end-result. I wonder if this can be done with conditional formating of any sort, or if I have to use VBA-code. And if so, can I use VBA to dynamically find the cells connected to the original?

1666784994444.png

1666785006929.png


Regards and thanks in advance,
FilleFrella
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
What is the logic that connect the colored number in the Sum column to which numbers should be colored in the Inputs column? Your example is actually too specific and does not give a general rule we can use to color the cells.
 
Upvote 0
Thank you for the reply, sorry in advance if I've missunderstood.

The "logic" as I see it is that the inputcells are connected through a formula to a cell. When I change the colour of the "output" cell, I want all cells which have been used as input for that cell to be coloured as well.

Further, if I do a "XLOOKUP", I want only the matching cells to be highlighted, not the entire range which was used. If I use a SUMIF, then all of the summed cells should be coloured.

I'm not sure if this is possible with an "easy" solution.
 
Upvote 0
The "logic" as I see it is that the inputcells are connected through a formula to a cell.
It would help if you provided the formula. It is not remotely possible to provide a solution based only on the screenshot above.
When I change the colour of the "output" cell, I want all cells which have been used as input for that cell to be coloured as well.
This will require VBA. There is no built-in Excel function that will give the you fill color of a cell.
Further, if I do a "XLOOKUP", I want only the matching cells to be highlighted
XLOOKUP returns one value, not a collection of matching cells. Can you be more specific about how you are using XLOOKUP and what results you want?
If I use a SUMIF
You seem to need a very general solution for a variety of formulas. I don't know if this is even feasible with more information about what the formulas could be. The idea is that you would need VBA to parse the formula and determine which cells are referenced. In the case of XLOOKUP, it would have to do even more than that and simulate the XLOOKUP to determine which cell gives the result. All of this sounds like a very big job to me.
 
Upvote 0
"You seem to need a very general solution for a variety of formulas. I don't know if this is even feasible with more information about what the formulas could be. The idea is that you would need VBA to parse the formula and determine which cells are referenced. In the case of XLOOKUP, it would have to do even more than that and simulate the XLOOKUP to determine which cell gives the result. All of this sounds like a very big job to me."

That is sort of what I'm after. I'm thinking that the VBA code would work with similar functionallity as the Alt+M+S function producing arrows to the cells used as inputs for formulas. See attached file (=SUM() the Excel I'm using now is Swedish but a need a solution for an English Excel).

The idea is that I often have cells which uses a XLOOKUP or SUMIF in PivotTables to sum/find values. And I'm working with considerably large datasets, and hence want to highlight cells which have already been used so that I can see if any value is (1) not yet used, or (2) I can highlight a specific sum and see if all of the values contained in that sum (the input-cells) really should be in that sum.

Sorry if my explonation is a bit messy, but greatly appricaite the help thus far. Just that I'm nudged towards VBA and that the colour cannot be determined by the "normal" Excel-funcitons is a great help.
 

Attachments

  • image_2022-11-04_135353599.png
    image_2022-11-04_135353599.png
    4.3 KB · Views: 4
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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