Home > database >  Conditional formatting between two values
Conditional formatting between two values

Time:11-02

Hi sorry I just really need some answer for this question. I'm only using my phone.

In the first pic is the simple conditional formatting that I use. Cell value with specific text

But in picture #2 is what I would like to happen. Even in the blank between there would be a color. Not sure if this is possible but I would like to hear from you guys.

Thank you.

Picture #1

enter image description here

Picture #2

enter image description here

CodePudding user response:

The following rules would work for the examples shown:

=OR(A2="ML",ISODD(COUNTIF($A2:A2,"ML")))

and

=OR(A2="LWOP",ISODD(COUNTIF($A2:A2,"LWOP")))

enter image description here

but the problem is if you had a single instance of (say) LWOP like this:

enter image description here

there is no way to tell which is a single instance and which denotes an interval.

I don't believe there is any way of resolving this except by using a separate code for one-off events like LWOPS and changing the formula to:

=OR(A2="LWOP",A2="LWOPS",ISODD(COUNTIF($A2:A2,"LWOP")))

enter image description here

CodePudding user response:

You can play with concatenation, something like:

=CONCAT(B2:$XFD2)  // concatenate from the cell itself to the most right
=CONCAT($A2:B2)    // concatenate from the most left to the cell itself
  • The cells, more to the left, will have an empty cell result.
  • Cell "B2" will be wrong (value "MLML") for the first, but correct for the second formula.
  • The cells in between will be correct (value "ML").
  • Cell "F2" will be correct for the first, but wrong (value "MLML") for the second formula.
  • The cells, more to the right, will have an empty cell result.

=> using an OR() function will give a correct result, and that OR()-based formula can be used as a formula for the conditional formatting:

enter image description here

  • Related