help: example for multiple-criteria conditional formatting

Issue #525 resolved
Mark Brown created an issue

Is it possible to provide an example on how to use multiple criteria? e.g., I would like to conditional formatting cells with rules: >= 5, color in red, <=1 color in green, otherwise, in yellow. Could not find this in document, so would really appreciate an example.

Comments (6)

  1. CharlieC

    I think you just want to add two different rules for the same cells and set their priorities. If you have an existing file then you can inspect it to work out how it's done: either look at the XML or load it in openpyxl and go through the conditional formatting.

    You can then make a PR with an improvement in the docs!

  2. Mark Brown reporter

    Thanks for the hints. Yes, you are right, just need to add the rules in the right order (the earlier ones get high priority automatically). Seems to work well.

  3. CharlieC

    Good to know you've got it working. The priorities can be tweaked manually if necessary.

    Please make a suggestion (via a pull request) on how the documentation can be improved.

  4. Log in to comment