Conditional Formatting

Dhinakaran

New Member
Joined
Mar 30, 2016
Messages
48
Office Version
  1. 365
  2. 2021
  3. 2016
Platform
  1. Windows
Hi,

From the below table, we have a 0(Zero's) repeated on multiple occasions and I wish to highlight the same basis the below conditions.

1. One instance of 0 should be highlighted in Yellow (under rows).
2. More than 1 instance of consecutive 0's to be highlighted in Red (under rows).

However the same couldn't be done using the conditional formatting, Hence seek assistance for the same.

Book1
ABCDEF
1DATE03-Jan04-Jan05-Jan06-Jan07-Jan
2AKLUJ0200.6400764.09
3AMBAJOGAI (BEED-DISTRICT)00000
4BAGALKOT99.8200189.46779.07
5BANGARPET482.821540.88129.03922.31267.17
6BG KERE1690.97116.21648.27177.15931.53
7CHANNARAYAPATNA0429.96001144.99
Sheet1
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
This can be done with conditional formatting.

$scratch.xlsm
ABCDE
1DATE3-Jan4-Jan5-Jan6-Jan
2AKLUJ0200.6400
3AMBAJOGAI (BEED-DISTRICT)0000
4BAGALKOT99.8200189.46
5BANGARPET482.821540.88129.03922.3
6BG KERE1690.97116.21648.27177.15
7CHANNARAYAPATNA0429.9600
Sheet8
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:E7Expression=AND(B2=0,OR(A2=0,C2=0))textNO
B2:E7Expression=B2=0textNO
 
Upvote 0
i used a countif() in normal conditional formatting

Book1
ABCDEF
1DATE4456444565445664456744568
2AKLUJ0200.6400764.09
3AMBAJOGAI (BEED-DISTRICT)0648.27177.15648.27177.15
4BAGALKOT99.8200189.46779.07
5BANGARPET482.821540.88129.03922.31267.17
6BG KERE1690.97116.21648.27177.15931.53
7CHANNARAYAPATNA0429.96648.27177.151144.99
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:F7Expression=COUNTIF($B2:$F2,0)>1textNO
B2:F7Expression=COUNTIF($B2:$F2,0)=1textNO
 
Upvote 0
This can be done with conditional formatting.
I agree, but if your interpretation of the requirement is correct, I think a different formula for red would most likely be required.
Try changing cell E5 in your layout to 0.

If MS365 is available, this would be one way.

22 02 07.xlsm
BCDEF
20200.6400764.09
300000
499.8200189.46779.07
5482.821540.88129.03922.31267.17
61690.97116.21648.27177.15931.53
70429.96001144.99
855550
CF0
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:F8Expression=LET(t,CONCAT(1,IF($B2:$F2=0,0,1)),OR(MID(t,COLUMNS($B:B),2)="00",MID(t,COLUMNS($B:B)+1,2)="00"))textNO
B2:F8Expression=B2=0textNO
 
Upvote 0
Try changing cell E5 in your layout to 0.

22 02 07.xlsm
ABCDE
1DATE1-Mar1-Apr1-May1-Jun
2AKLUJ0200.6400
3AMBAJOGAI (BEED-DISTRICT)0000
4BAGALKOT99.8200189.46
5BANGARPET482.821540.88129.030
6BG KERE1690.97116.21648.27177.15
7CHANNARAYAPATNA0429.9600
CF Test
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:E7Expression=AND(B2=0,OR(A2=0,C2=0))textNO
B2:E7Expression=B2=0textNO
 
Upvote 0
Thank you. Minor tweak to omit considering blank cells.

$scratch.xlsm
ABCDE
1DATE3-Jan4-Jan5-Jan6-Jan
2AKLUJ0200.6400
3AMBAJOGAI (BEED-DISTRICT)0000
4BAGALKOT99.8200189.46
5BANGARPET482.821540.88129.030
6BG KERE1690.97116.21648.27177.15
7CHANNARAYAPATNA0429.9600
Sheet8
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:E7Expression=AND(AND(B2<>"",B2=0),OR(AND(A2<>"",A2=0),AND(C2<>"",C2=0)))textNO
B2:E7Expression=B2=0textNO
 
Upvote 0
If our interpretation of the requirement is the correct one then here is a much simpler way than my previous one, and also does not require MS365.
Also a check in case a single cell happens to be blank, not zero.

22 02 07.xlsm
ABCDEF
1DATE3-Jan4-Jan5-Jan6-Jan7-Jan
2AKLUJ0200.6400764.09
3AMBAJOGAI (BEED-DISTRICT)00000
4BAGALKOT99.8200189.46779.07
5BANGARPET482.821540.88129.03922.31267.17
6BG KERE1690.97116.21648.27177.15931.53
7CHANNARAYAPATNA0429.96001144.99
8ABC5550
CF0 (2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:F8Expression=FIND("|0|0|","|"&A2&"|"&B2&"|"&C2&"|")textNO
B2:F8Expression=B2&""="0"textNO
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top