SOLVED

How to have a cell follow a formula ONLY if the cell it's mapping to is a certain colour?

Copper Contributor

I'm not sure if it's possible and I don't have a screen shot (I'm on a computer that doesn't have excel atm) but I'll try my best to explain:

I have a formula in A1:

=B2

 

However, I only want A1 to equal B2 if B2 is shaded yellow. 

Is this possible?

 

Thanks in advance!

2 Replies
best response confirmed by HeatherFX (Copper Contributor)
Solution

Yeah you can do it but you need to be tricky for this

 

First read this article https://excelsirji.com/vba-code-to-count-cells-by-color/ 

 

Use second code given on this link and then use if formula

Put the Yellow color on A2 (or anywhere just change the reference in below formula then) cell and enter this formula in A1

=if(CountByColor(B2,A2)>0,B2,0)

1 best response

Accepted Solutions
best response confirmed by HeatherFX (Copper Contributor)
Solution

Yeah you can do it but you need to be tricky for this

 

First read this article https://excelsirji.com/vba-code-to-count-cells-by-color/ 

 

Use second code given on this link and then use if formula

Put the Yellow color on A2 (or anywhere just change the reference in below formula then) cell and enter this formula in A1

=if(CountByColor(B2,A2)>0,B2,0)

View solution in original post