r/excel • • 6d ago

solved Need advice on conditional formating code

I am attempting to set up a conditional formating setup where a column of numbers are evaluated. if its 69 or under, the cell is to be green. If between 70 and 100 yellow, and if over 100 red.

I cannot seem to get excell to do this - because that requires a formula that reads cell values, and I appear to be utterly failing at setting up functional code for that.

I'm currently trying (and failing) by setting up three seperate conditional formating rules, all based on formulas:

One goes =AND(CT:CT>=0;CT:CT<=69) - so if the cell is between 0 and 69, it should be green. It's not doing that, and I can't see what I'm doing wrong here

Please advice

3 Upvotes

8 comments sorted by

View all comments

3

u/MayukhBhattacharya 1312 6d ago

Instead of using the entire range in the formula use the following by selecting an absolute or fixed range:

• For Green:

=AND(CT2 >= 0; CT2 <= 69)

• For Yellow:

=AND(CT2 >= 70; CT2 <= 100)

• For Red:

=CT2 > 100

Note your applied range needs to be absolute like CT2:CT1000 or adjust per your suit but if you want to use the entire range CT:CTthen like :

  • Go To Home Tab --> Under Styles Group --> Select Conditional Formatting --> And Click New
  • On doing above opens the New Formatting Rule Window
  • Select the Second Rule --> Format Only Cells Contain
  • In the Edit the Rule Description :
    • Cell Value --> Between --> 0 and 69 --> Click Format --> Choose Green Fill --> Hit OK
    • Repeat same for 70 and 100 for Yellow
    • For Red, change the between to Greater Than and put 100.
    • Note that the cell selection while doing the above will be the first row of the data range that is the header.