Hi,
I have data in multiple rows (Row 2 to Row 6) and columns (Col. A to Col. M).
Either of the 2 formulae given below are used for conditional formatting in Row 2. The formulae compare whether any of the cells in rows 3, 4, 5 and 6 contains the same value falling within a particular range of any of the cell values in row 2. If the condition is true, then the corresponding cell in row 2 is highlighted. The range (i.e. plus or minus from values in row 2) is defined in cell O2.
This is the preferred formula for use, since a single formula for conditional formatting can cover multiple rows. Would prefer if a solution can be provided for this Formula
The formulae work correctly as long as all the 5 rows have data in it (which is correct since I am using AND condition for validation). However, sometimes, one of the rows might be Blank or may contain Zero value.
In such condition, I want the formulae (AND operator) to ignore the rows containing blank or zero values and consider only the rows containing actual values for the purpose of validation. For example, in case row 5 is empty, then the formula should compare values in row 2, only with values in rows 3, 4 and 6, and if found true, then highlight the corresponding cells in row 2. Row 5 should be ignored.
Note: Sample file attached. Screenshot of sample data is given below.
Also, I had posted this request at ExcelForum.com Since no useful reply received there, I am posting the request here.
1. Sample data for First formula:
Sample data for second formula:
I have data in multiple rows (Row 2 to Row 6) and columns (Col. A to Col. M).
Either of the 2 formulae given below are used for conditional formatting in Row 2. The formulae compare whether any of the cells in rows 3, 4, 5 and 6 contains the same value falling within a particular range of any of the cell values in row 2. If the condition is true, then the corresponding cell in row 2 is highlighted. The range (i.e. plus or minus from values in row 2) is defined in cell O2.
This is the preferred formula for use, since a single formula for conditional formatting can cover multiple rows. Would prefer if a solution can be provided for this Formula
Excel Formula:
COUNT(MMULT(--(ABS(A2-$A$2:$M$6)<=$O$2),TRANSPOSE(COLUMN($A$2:$M$6)^0))^0)=ROWS($A$2:$M$6)
Excel Formula:
=AND(SUMPRODUCT(--(ABS($A3:$M3-A2)<=$O$2)),SUMPRODUCT(--(ABS($A4:$M4-A2)<=$O$2)),SUMPRODUCT(--(ABS($A5:$M5-A2)<=$O$2)),SUMPRODUCT(--(ABS($A6:$M6-A2)<=$O$2)))
The formulae work correctly as long as all the 5 rows have data in it (which is correct since I am using AND condition for validation). However, sometimes, one of the rows might be Blank or may contain Zero value.
In such condition, I want the formulae (AND operator) to ignore the rows containing blank or zero values and consider only the rows containing actual values for the purpose of validation. For example, in case row 5 is empty, then the formula should compare values in row 2, only with values in rows 3, 4 and 6, and if found true, then highlight the corresponding cells in row 2. Row 5 should be ignored.
Note: Sample file attached. Screenshot of sample data is given below.
Also, I had posted this request at ExcelForum.com Since no useful reply received there, I am posting the request here.
1. Sample data for First formula:
sample_2 formulae.xlsx | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | |||
1 | A | B | C | D | E | F | G | H | I | J | K | L | M | Range | ||||
2 | 86 | 93 | 99 | 79 | 57 | 56 | 95 | 73 | 68 | 65 | 72 | 62 | 72 | 2 | ||||
3 | 86 | 68 | 74 | 84 | 74 | 90 | 63 | 74 | 66 | 78 | 83 | 53 | 57 | |||||
4 | 80 | 57 | 84 | 82 | 54 | 80 | 86 | 97 | 77 | 59 | 78 | 65 | 62 | |||||
5 | 93 | 83 | 91 | 82 | 86 | 61 | 82 | 50 | 87 | 79 | 69 | 80 | 84 | |||||
6 | 81 | 82 | 87 | 79 | 56 | 80 | 96 | 76 | 99 | 98 | 91 | 92 | 82 | Check that the Conditional Formatting fails in case: | ||||
7 | 1. Delete all data in all cells in any of the rows in Col. A to M | |||||||||||||||||
8 | 2. Enter Zero in all cells in any of the rows from Col. A to M | |||||||||||||||||
9 | Formula: | COUNT(MMULT(--(ABS(A2-$A$2:$M$6)<=$O$2),TRANSPOSE(COLUMN($A$2:$M$6)^0))^0)=ROWS($A$2:$M$6) | ||||||||||||||||
10 | ||||||||||||||||||
11 | TRUE | FALSE | FALSE | TRUE | FALSE | FALSE | FALSE | FALSE | FALSE | FALSE | FALSE | FALSE | FALSE | |||||
12 | TRUE | FALSE | FALSE | TRUE | FALSE | FALSE | FALSE | FALSE | FALSE | TRUE | FALSE | FALSE | FALSE | |||||
13 | TRUE | FALSE | TRUE | FALSE | FALSE | TRUE | TRUE | FALSE | TRUE | FALSE | TRUE | FALSE | FALSE | |||||
14 | FALSE | FALSE | FALSE | FALSE | TRUE | FALSE | FALSE | FALSE | TRUE | TRUE | FALSE | TRUE | TRUE | |||||
15 | TRUE | FALSE | TRUE | TRUE | FALSE | TRUE | FALSE | FALSE | FALSE | FALSE | FALSE | FALSE | FALSE | |||||
FORMULA 2 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A11:M15 | A11 | =COUNT(MMULT(--(ABS(A2-$A$2:$M$6)<=$O$2),TRANSPOSE(COLUMN($A$2:$M$6)^0))^0)=ROWS($A$2:$M$6) |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
A2:M6 | Expression | =COUNT(MMULT(--(ABS(A2-$A$2:$M$6)<=$O$2),TRANSPOSE(COLUMN($A$2:$M$6)^0))^0)=ROWS($A$2:$M$6) | text | NO |
Sample data for second formula:
sample_2 formulae.xlsx | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | |||
1 | A | B | C | D | E | F | G | H | I | J | K | L | M | Range | |||
2 | 86 | 93 | 99 | 79 | 57 | 56 | 95 | 73 | 68 | 65 | 72 | 62 | 72 | 2 | |||
3 | 86 | 68 | 74 | 84 | 74 | 90 | 63 | 74 | 66 | 78 | 83 | 53 | 57 | ||||
4 | 80 | 57 | 84 | 82 | 54 | 80 | 86 | 97 | 77 | 59 | 78 | 65 | 62 | ||||
5 | 93 | 83 | 91 | 82 | 86 | 61 | 82 | 50 | 87 | 79 | 69 | 80 | 84 | ||||
6 | 81 | 82 | 87 | 79 | 56 | 80 | 96 | 76 | 99 | 98 | 91 | 92 | 82 | ||||
FORMULA 1 |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
A2:M2,O2 | Expression | =AND(SUMPRODUCT(--(ABS($A3:$M3-A2)<=$O$2)),SUMPRODUCT(--(ABS($A4:$M4-A2)<=$O$2)),SUMPRODUCT(--(ABS($A5:$M5-A2)<=$O$2)),SUMPRODUCT(--(ABS($A6:$M6-A2)<=$O$2))) | text | NO |