Conditional formatting based on a field below

%3CLINGO-SUB%20id%3D%22lingo-sub-2143631%22%20slang%3D%22en-US%22%3EConditional%20formatting%20based%20on%20a%20field%20below%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2143631%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I%20have%20the%20following%20table%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Wojciech_Plonka_1-1613580974025.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F255546i24E1DBB01F668390%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Wojciech_Plonka_1-1613580974025.png%22%20alt%3D%22Wojciech_Plonka_1-1613580974025.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEach%20actual%20value%20is%20relating%20to%20the%20%22Planned%22%20value%20below.%20I%20would%20like%20each%20%22Actual%22%20value%20to%20have%20a%20red%20colour%20if%20the%20planned%20value%20is%200%20or%20green%20if%20the%20number%20is%20equal%20to%20the%20%22Planned%22%20value%20below.%20Each%20field%20can%20have%20a%20different%20planned%20value%2C%20so%20I%20need%20a%20smart%20formula.%3CBR%20%2F%3E%3CBR%20%2F%3EAre%20they%20any%20ways%20to%20do%20it%3F%20Thank%20you%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2143631%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2143697%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20formatting%20based%20on%20a%20field%20below%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2143697%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F878588%22%20target%3D%22_blank%22%3E%40Wojciech_Plonka%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20to%20replicate%20what%20you%20ask%20for.%20Something%20like%20that%3F%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22WP_Question.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F255552i12E0DDB16D50CD3F%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22WP_Question.png%22%20alt%3D%22WP_Question.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi, I have the following table:

Wojciech_Plonka_1-1613580974025.png

 

Each actual value is relating to the "Planned" value below. I would like each "Actual" value to have a red colour if the planned value is 0 or green if the number is equal to the "Planned" value below. Each field can have a different planned value, so I need a smart formula.

Are they any ways to do it? Thank you

6 Replies

@Wojciech_Plonka 

I tried to replicate what you ask for. Something like that?

WP_Question.png

@Wojciech_Plonka 

 

Absolutely there are ways to do it.

 

If I were you, however, I'd put the cells side-by-side if you can. Makes it easier, and probably would make more sense design wise.

 

Anyway, here's an example. I used a random number generator just to put it through its paces. To get a whole new set of numbers, just activate the F9 key. With a mac that's done by holding the Fn key and pressing the key along the top row with F9 appearing on it.

 

@Wojciech_Plonka 

Hi

 

I think this might be what you want? This uses conditional formatting and might help you?

 

BTW - is there any reason why you have to layout with actual above planned? If you have actual next to planned (as shown on the right hand side) that it is easier to understand and the formatting also is simpler.

 

hope this helps.

 

Peter

You and I think alike. I made the same recommendation: change to side-by-side!

Well, the trick is - there will be thousands of rows like this, so setting this up manually would be a hell, also, changing format is impossible unfortunately


@PhilipTx @mathetes @peteryac60 

@Wojciech_Plonka 

Yes, my solution would probably only work in a limited environment and was a basic attempt to understand your issue. If you apply the rule itself to the first rows you just got just replicate the format.  I can then only recommend to try a solution with visual basics. I used that in certain applications.   

 

 

 

Example for visual basics: 

 

PhilipTx_0-1613648254374.png

 

 

Sub Kontrollkästchen61_Klicken()
If ActiveSheet.Shapes("Kontrollkästchen 61").OLEFormat.Object.value = 1 Then


Range("M67").Interior.ColorIndex = 6

Else
Range("M67").Interior.ColorIndex = xlNone

End If
ganzeZeile
End Sub
Sub Kontrollkästchen62_Klicken()
If ActiveSheet.Shapes("Kontrollkästchen 62").OLEFormat.Object.value = 1 Then


Range("N67").Interior.ColorIndex = 6

Else
Range("N67").Interior.ColorIndex = xlNone

End If
ganzeZeile
End Sub
Sub Kontrollkästchen63_Klicken()
If ActiveSheet.Shapes("Kontrollkästchen 63").OLEFormat.Object.value = 1 Then


Range("O67").Interior.ColorIndex = 6

Else
Range("O67").Interior.ColorIndex = xlNone

End If
ganzeZeile
End Sub
Sub ganzeZeile()

If ActiveSheet.Shapes("Kontrollkästchen 61").OLEFormat.Object.value = 1 And ActiveSheet.Shapes("Kontrollkästchen 62").OLEFormat.Object.value = 1 And ActiveSheet.Shapes("Kontrollkästchen 63").OLEFormat.Object.value = 1 Then

Range("A66:L68").Interior.ColorIndex = 6

Else

Range("A66:L68").Interior.ColorIndex = xlNone

End If
End Sub

 

There are likely more elegant or sophisticated approaches for this, but that would be a way to adress your issue. In future Excel will open up even further.