简体   繁体   中英

Excel Conditional Formatting Formula

I am trying to make a column do this: so lets say If the score of 4 is made from a 2 x 2 then it is green. If the score of 4 is made from a 4 x 1 or a 1 x 4 then it is yellow.

I am done the formula for the green and the yellow but it only happens once. So if I change a 2 x 2 to 4 x 1. It will stay green. Not change to yellow.

Formula for Green (2x2): =IF(G31=4,IF(D15=2,IF(F15=2,0,1),1),0)

Formula for Yellow (4x1, 1x4): =IF(G31=4,IF(D15=4,IF(F15=1,0,1),1),0)

Please help me work this one out. Thank you. enter image description here

Tried the formula but does not work, even if I remove every other formula: enter image description here

Use a combination of AND and OR

Formula for Yellow (4x1, 1x4) =AND($G31=4, OR($D15=1, $D15=4))

Formula for Green (2x2) =AND($G31=4, $D15=2)

EDIT

As per your screenshot, if you are trying to change a range, not just cell G31 , use the following:

Formula for Yellow (4x1, 1x4) =AND($G1=4, OR($D1=1, $D1=4))

Formula for Green (2x2) =AND($G1=4, $D1=2)

Change the number 1 for the starting row of your cells (3, 4, 5 whatever) and set the Range to be =$G$1:$G$100 again changing the 1 and 100 for your start and end row.

I cannot stress enough, if your data does not start in row 1, you will need to edit the above to suit your needs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM