Conditional Formatting linked to String Length

WildWill

Board Regular
Joined
Sep 10, 2009
Messages
92
Hello

Please assist me with the following: I have a cell with a string of numbers that should always be 13 characters in length. I want to setup the cell using Conditional Formatting so that for any instance where the number of characters (always numbers), is either less than 13 or more than 13, that cell will be highlighted in red. How do I do this in Excel 2007?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try This :
Format - Cond. Formating - Formula is

Code:
=LEN($A$1)<> 13

Pattern - Choose Colour

* change cell value accordingly
 
Upvote 0
Try This :
Format - Cond. Formating - Formula is

Code:
=LEN($A$1)<> 13

Pattern - Choose Colour

* change cell value accordingly

One more feature that I need to add to the request: Can you change the solution so that it will only consider cells that are not empty? Right now, all my cells light up in red, event the empty ones. Thanks!
 
Upvote 0
change the formula to -
Code:
=IF(OR(A1 ="",A1 =13),"",LEN(A1)<> 13)

* Change cell ref accordingly
 
Upvote 0
Sorry, previous formula is incorrect.

Please use below formula :
Code:
=IF(A1 ="","",LEN(A1)<> 13)
[/CODE]
 
Upvote 0
I have a similar need. I need to know when the number of characters in a cell exceeds 30. I only need to know this for columns I-L. So I highlighted those columns... went to conditional formatting... in the formula portion put in =LEN($I:$L)>30 ... and in the formatting I chose to change the fill color to red.

Except it's not working... what am I doing wrong?
 
Upvote 0
Usually you need to just enter the formula which applies to the top left cell in your range - that's I1 so formula should be just

=LEN(I1)>30

It adjusts automatically for the other cells in the range as long as you don't include $ signs
 
Upvote 0

Forum statistics

Threads
1,211,434
Messages
6,101,826
Members
447,758
Latest member
jojo3strada

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