Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Conditional formatting based on a separate condition in another cell

0

Is there a way to use conditional formatting in a cell, but based on a condition from another cell.

ie. If Cell A1 = X Then if B1 = 2, I want the background colour of B1 to be Blue, but if the cell A1 = Y and B1 = 2 I want the background colour of B2 to be Red.

Its probably either not possible or a very simple solution. Im pretty much a novice when it comes to excel programming

Thank you

Answer
Discuss

Answers

1
Selected Answer

Hello Nick_1963

You are correct when you say "a very simple solution".

1) Select cell B1

2) On the 'Home' tab click 'Conditional Formatting', then 'New Rule'

3) Select the last option 'Use a formula to determine which cells to format'

4) Click in the 'Format values where this formula is true' field and press"F2" (this allows editing just like in a worksheet cell)

5) Enter the following formula: =AND(2<=A1,A1<=10,B1 = 2) [you haven't specified what "x" and "y" are so you will need to edit the values for "A1" to suit your needs]

6) Click 'Format

7) In the window that opens click the "Fill" tab; select the blue you want and click "OK"; click "OK" again and that's it.

8) Repeat 2 thru 7; edit the values for "A1" to suit, and select the red you want.

Cheers   ;-}

Discuss

Discussion

Thank you so much WillieD24, worked a treat :)
Nick_1963 (rep: 2) Aug 19, '20 at 6:47 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login