Conditional formatting for specific number of digits

azad092

Board Regular
Joined
Dec 31, 2019
Messages
158
Office Version
  1. 2007
Platform
  1. Windows
Dear Members
I am using a data sheet for data entry including a column call time. In call time I enter call time from 0000 to 2359 in different cells of the entire column according to my data need. some time by mistake I enter the call time which is not belong to 0000 to 2359 i.e instead of 0059 I enter 0060 or instead of 2359 I enter 2360 or 2400 which is not a correct time. In this condition I want to apply conditional formatting please help me if someone knows about it
 

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
48,400
Office Version
  1. 365
Platform
  1. Windows
Something like this?

20 11 05.xlsm
C
1Call Time
20000
30255
40279
52400
6
71203
812344
9
10
CF Wrong Time
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:C10Expression=OR(LEN(C2)<>4,LEFT(C2,2)-23>0,RIGHT(C2,2)-59>0)textNO
 

azad092

Board Regular
Joined
Dec 31, 2019
Messages
158
Office Version
  1. 2007
Platform
  1. Windows
Something like this?

20 11 05.xlsm
C
1Call Time
20000
30255
40279
52400
6
71203
812344
9
10
CF Wrong Time
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:C10Expression=OR(LEN(C2)<>4,LEFT(C2,2)-23>0,RIGHT(C2,2)-59>0)textNO
thanks for your kind reply
you understand well, but the coding that you share is not working please guide further
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
48,400
Office Version
  1. 365
Platform
  1. Windows
coding that you share is not working please guide further
I cannot guide further if you give me nothing to go on. For example
- what is happening (wrong values being formatted or all values being formatted or no values being formatted)

Does my sample look correct for what you want?

Can you confirm that the Call Time column is formatted as Text (since leading zeros I assume are expected in some cases)?

Did you adjust the formula to suit whatever column & rows your data is in?

What cell is the Call Time heading in on your worksheet?
 

azad092

Board Regular
Joined
Dec 31, 2019
Messages
158
Office Version
  1. 2007
Platform
  1. Windows
I cannot guide further if you give me nothing to go on. For example
- what is happening (wrong values being formatted or all values being formatted or no values being formatted)

Does my sample look correct for what you want?

Can you confirm that the Call Time column is formatted as Text (since leading zeros I assume are expected in some cases)?

Did you adjust the formula to suit whatever column & rows your data is in?

What cell is the Call Time heading in on your worksheet?
Hi peter
thanks for your kind reply
I have resolve the problem by making a time list, through the time list I cant control the error of irregular digits of time... but I also thankful to your for your kind attention.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
48,400
Office Version
  1. 365
Platform
  1. Windows
You're welcome. Glad you have resolved the problem. Thanks for letting us know. (y)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,791
Messages
5,626,898
Members
416,208
Latest member
tan21

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
Top