Format according to multiple conditions - excel

I have the following conditional formats, and I am wondering if it is possible to join them together in one, so I don't need to add them all separately:
IF($A11&$D11=$W$14;AND($K11>$X$14;$K11<$Y$14))
IF($A11&$D11=$W$15;AND($K11>$X$15;$K11<$Y$15))
IF($A11&$D11=$W$16;AND($K11>$X$16;$K11<$Y$16))
IF($A11&$D11=$W$17;AND($K11>$X$17;$K11<$Y$17))
IF($A11&$D11=$W$18;AND($K11>$X$18;$K11<$Y$18))
IF($A11&$D11=$W$19;AND($K11>$X$19;$K11<$Y$19))
IF($A11&$D11=$W$20;AND($K11>$X$20;$K11<$Y$20))
IF($A11&$D11=$W$21;AND($K11>$X$21;$K11<$Y$21))
IF($A11&$D11=$W$22;AND($K11>$X$22;$K11<$Y$22))
IF($A11&$D11=$W$23;AND($K11>$X$23;$K11<$Y$23))
IF($A11&$D11=$W$24;AND($K11>$X$24;$K11<$Y$24))
IF($A11&$D11=$W$25;AND($K11>$X$25;$K11<$Y$25))
IF($A11&$D11=$W$26;AND($K11>$X$26;$K11<$Y$26))
IF($A11&$D11=$W$27;AND($K11>$X$27;$K11<$Y$27))
IF($A11&$D11=$W$28;AND($K11>$X$28;$K11<$Y$28))
IF($A11&$D11=$W$29;AND($K11>$X$29;$K11<$Y$29))
IF($A11&$D11=$W$30;AND($K11>$X$30;$K11<$Y$30))
IF($A11&$D11=$W$31;AND($K11>$X$31;$K11<$Y$31))
IF($A11&$D11=$W$32;AND($K11>$X$32;$K11<$Y$32))
IF($A11&$D11=$W$33;AND($K11>$X$33;$K11<$Y$33))
Green fill to be applied to $K$11:$K$344 within a Table:
If this can be done easily in VBA, that could do as well.

Please select K11:K344 and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=AND(K11>=VLOOKUP(A11&D11,W$14:Y$344,2,0),K11<=VLOOKUP(A11&D11,W$14:Y$344,3,0))
Format..., select green, OK, OK.

You can maybe use COUNTIFS:
=COUNTIFS($U$11:$U$33,A11,$V$11:$V$33,D11,$X$11:$X$33,"<"&K11,$Y$11:$Y$33,">"&K11)
The above does not need the concatenated Region and Site Type (thus more criteria can be added as needed), but if you already have it, you can shorten it a little bit:
=COUNTIFS($W$11:$W$33,A11&D11,$X$11:$X$33,"<"&K11,$Y$11:$Y$33,">"&K11)
The set up of the conditional formatting remains the same.
COUNTIFS will return a number above 0 (interpreted as true) if there any matches to the Region, Site Type, lower and upper bounds, otherwise will return 0.

Related

Conditional Formatting not enough

I'm trying to set conditional formatting in a specific group of cells J9:N12 with a locked cell I9 (110). In Cells J9:N12 I need the conditional formatting to set 1,2,7,8,13,14 as Black Fill w/ White Text, 3,4,9,10,15,16 as Red Fill w/ Black Text, 5,6,11,12,17,18 as Blue Fill w/ White Text. Then if I Change (I9) to 277 the Fills would change to reflect Brown/Orange/Yellow in place of the Black/Red/Blue.
Yes, I can Conditional Format the cells I need based on the information set in cell (I9) 110 or 277.
The series of numbers I need to format is greater than 120. I cannot set Conditional Formatting for each specific number needed. Minimallistically I need to be able to set Conditional Formatting to around 150-160 numbers.
I don't know if I need to utilize VBA or if Conditional Formatting is the way to go.
You could use conditional formatting for this. I'd be tempted to put the number series in an array and test for a find in the array using MATCH. This way, you'd only need as many conditional formatting rules as there are number series.
I'm not certain, but I believe you can't write an array directly into a conditional format rule, but you could refer to it from something like a range name. In any event, a range name would be easier to manage if you needed to change any of the number series.
For example, in the black/brown case, you could create a range name (Formulas->Define Name), called black-brown, and in the Refers To window, have the formula:
={1,2,7,8,13,14}
Then your conditional formatting rule would be something like:
=AND($I$9=110,NOT(ISNA(MATCH(B2,black_brown,0))))
Note my cell to be tested is in B2 - change that to whatever you need.
You'd just add rules for each of your number series cases, as shown below:

Coloring cells that have matching text

I have a set of required items spread across A1:H40 and a buylist in col. J. I was reading this, but I'm a bit overwhelmed.
How do I color the cells across A1:H40 with text that match the ones in col. J?
Is there a way to incorporate this function into a button so that it can be applied to other spreadsheets as well (or any other efficient way)?
In addition, is there a way to design a fool-proof script that eliminates the excessive spaces at the end of each cell due to typing errors?
Clear existing CF from and select A1:H40 and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=COUNTIF($J:$J,A1)
Format..., select formatting of your choice, OK, OK.
Seems to me not to require a button to make this any easier, and 'spaces' is a completely different Q that should not be combined with another.

Excel conditional formatting exclude if a, b or c exists in cell

I use below code to format if Column A begins with 1, 2, 3, 4 or 5 but I would like to exclude three cells that has following text 00a, 00b, 00c.
Can I exlude if A-Z exists? I don´t want all numbers to be formatted for example 800 should be excluded.
All cells is format to text to keep zero at the beggining eg. "001", "099".
=OR(LEFT(A1;1)="0";LEFT(A1;1)="1";LEFT(A1;1)="2";LEFT(A1;1)="3";LEFT(A1;1)="4";LEFT(A1;1)="5")
As I (roughly) understand the requirement, clear existing CF from and select ColumnA and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=AND(LEFT(A1)<>"0",LEFT(A1)*1<6,ISERROR(FIND("00a",A1)),ISERROR(FIND("00b",A1)),ISERROR(FIND("00c",A1)))
Format..., select formatting of your choice, OK, OK.
As I suspect the requirement may not have been fully described (see mcve) I have made no attempt to shorten the above, though doing so seems possible.

IS there a do not match function

I am trying to do 2 functions. The first is to match all the values (text) from 1 range with another and return the values that match. I would also like a second formula that returns the values that do not match. The 2 lists may not be in the same order nor can they be as they are ranked.
=IFERROR(INDEX($L$4:$L$23,MATCH($B15,$L$4:$L$23,0)),$L15&" Different")
Could anyone suggest an answer?
Thank you in advance
There is no native function of the kind I think you require.
With two unsorted ranges, say B4:B25 and L4:L25, one can identify matches and non-matches with Conditional Formatting and then perhaps might choose to filter by colour to extract matches or non-matches.
Select both ranges and (standard) fill red. Select B4:B25 and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=COUNTIF(L$4:L$25,B4)
Format..., select green (suggestion) fill, OK, OK.
Then select L4:L25 and repeat CF with:
=COUNTIF(B$4:B$25,L4)
I think that IFNA(INDEX($L$4:$L$23,MATCH($B15,$L$4:$L$23,0)), "NO MATCH") would help you solve this.

Conditional Formatting exact text match

I have several spreadsheets where I want to highlight all the rows where the data matches a separate list. I have used a rule for this but it's not highlighting it exactly; it's just matching part of the word, for example General manager in one list is highlighting Manager in the other list whereas I would only want it to highlight General manager.
This is the formula I've used:
=COUNTIF(A92:A400,L2:L196)
and I've also tried MATCH but it pulled out out even more incorrect matches.
You will have to bring in the EXACT function somewhere.
    
This CF rule was created by selecting A1:D7 and creating a rule based upon the following formula,
=AGGREGATE(15, 6, ROW(1:1)/EXACT($A1, $F$8:$F$10), 1)
The way I interpret the question is that case sensitivity may not be required, rather that use of wildcards may be causing issues (ie that exact text match is not applying "exact" in quite the same way the EXACT function does). If the separate list is the one in ColumnL then please select from A92 to A400 and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=COUNTIF(L$2:L$196,A92)
Format..., select your choice of highlighting, OK, OK.
If to be applied to several sheets it may be convenient to Name the L2:L196 range.
The above highlights cells rather than rows, but that could be adjusted.

Resources