SOLVED

Fill background color of cell 1 if cell 1 is included in cell 2 formula

%3CLINGO-SUB%20id%3D%22lingo-sub-2795924%22%20slang%3D%22en-US%22%3EFill%20background%20color%20of%20cell%201%20if%20cell%201%20is%20included%20in%20cell%202%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2795924%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20add%20a%20fill%20color%20to%20cell%201%20if%20cell%201%20is%20included%20in%20the%20formula%20of%20a%20cell%202.%3C%2FP%3E%3CP%3EAlso%2C%20it%20would%20need%20to%20remove%20fill%20color%20from%20cell%201%20if%20it%20is%20removed%20from%20cell%202.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20attached%20an%20example.%3C%2FP%3E%3CP%3EIs%20this%20doable%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2795924%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20for%20web%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2796048%22%20slang%3D%22en-US%22%3ERe%3A%20Fill%20background%20color%20of%20cell%201%20if%20cell%201%20is%20included%20in%20cell%202%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2796048%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1170325%22%20target%3D%22_blank%22%3E%40bapatri%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20confused%20when%20you%20say%20%22included%20in%20the%20formula%20...%22%20you%20mean%20the%20value%20as%20a%20result%20of%20the%20formula%20or%20the%20range%20(AC75)%20on%20the%20formula%20itself%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2796061%22%20slang%3D%22en-US%22%3ERe%3A%20Fill%20background%20color%20of%20cell%201%20if%20cell%201%20is%20included%20in%20cell%202%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2796061%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F767933%22%20target%3D%22_blank%22%3E%40Juliano-Petrukio%3C%2FA%3E%26nbsp%3BThe%20range%20of%20the%20formula.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2796189%22%20slang%3D%22en-US%22%3ERe%3A%20Fill%20background%20color%20of%20cell%201%20if%20cell%201%20is%20included%20in%20cell%202%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2796189%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1170325%22%20target%3D%22_blank%22%3E%40bapatri%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20to%20admit%20that%20it%20is%20the%20first%20time%20I%20see%20something%20like%20that.%3C%2FP%3E%3CP%3EWell%2C%20the%20conditional%20formatting%20formula%20would%20be%20something%20like%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DFIND(SUBSTITUTE(ADDRESS(ROW()%2CCOLUMN())%2C%22%24%22%2C%22%22)%2CFORMULATEXT(%24B15))%26gt%3B0%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3BRemember%20to%20change%20the%20reference%20where%20the%20%22main%22%20formula%20is.%20This%20case%20the%20formula%20is%20on%20B15%3C%2FP%3E%3CP%3EFind%20attachment.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2796259%22%20slang%3D%22en-US%22%3ERe%3A%20Fill%20background%20color%20of%20cell%201%20if%20cell%201%20is%20included%20in%20cell%202%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2796259%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F767933%22%20target%3D%22_blank%22%3E%40Juliano-Petrukio%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20should%20work!%3CBR%20%2F%3EAND%20I%20admit%20I%20am%20not%20very%20fluent%20with%20excel.%3CBR%20%2F%3EI%20have%20attached%20the%20file%20in%20question.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIdeally%2C%20I%20would%20be%20able%20to%20assign%20a%20color%20to%20the%20total%20from%20the%20high%2C%20medium%20and%20low%20priority%20cells%2C%20and%20excel%20would%20magically%20fill%20in%20the%20background%20colors%20of%20all%20cells%20included%20in%20the%20range%20of%20the%20formula.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I am trying to add a fill color to cell 1 if cell 1 is included in the formula of a cell 2.

Also, it would need to remove fill color from cell 1 if it is removed from cell 2.

 

I have attached an example.

Is this doable?

12 Replies

@bapatri 

I'm confused when you say "included in the formula ..." you mean the value as a result of the formula or the range (AC75) on the formula itself?

 

best response confirmed by bapatri (Occasional Contributor)
Solution

@bapatri 

I need to admit that it is the first time I see something like that.

Well, the conditional formatting formula would be something like that.

 

=FIND(SUBSTITUTE(ADDRESS(ROW(),COLUMN()),"$",""),FORMULATEXT($B15))>0

 Remember to change the reference where the "main" formula is. This case the formula is on B15

Find attachment.

@Juliano-Petrukio 

 

This should work!
AND I admit I am not very fluent with excel.
I have attached the file in question.

 

Ideally, I would be able to assign a color to the total from the high, medium and low priority cells, and excel would magically fill in the background colors of all cells included in the range of the formula.

It works, thank you!!
I can't figure out how to duplicate to other cells. Any advice or tutorials?

@bapatri 

You just need to select the cells you want to apply the formatting

JulianoPetrukio_0-1632944982801.png

On Applies to you change the range you want to apply

JulianoPetrukio_1-1632945006985.png

 

Anytime.
Remember that hitting the like button is less costly than buying me a coffee.

@Juliano-Petrukio 

I did virtually the same as you, with the exception that I used a column of defined names to identify the references rather than using ADDRESS and direct referencing.  My feeling, though, was to write,

"yes, what the OP requires is technically possible using FORMULATEXT, but I wouldn't recommend it". 

I would prefer to see a specific data field to hold the {"high","medium","low"} and drive the formula from the data rather than the reverse.  What are your thoughts?

I agree with you but sometimes the user wants something like that.
For sure with time we can propose a simpler solution and I hope more topics can be raised by him very soon with more challenges.
As I told "(...) it is the first time I've seen something like that." It was fun to assist him somehow.

@Juliano-Petrukio 

Just to 'come up with the goods' and demonstrate that I had come up with a similar solution.

Mine probably has higher set up costs because I used defined names, but, then, I use defined names for everything.