PC Review


Reply
Thread Tools Rate Thread

conditional formatting for wrongly entered 9 digit numbers

 
 
andreashermle
Guest
Posts: n/a
 
      2nd Nov 2009
Dear Experts:

I need to enter 9 digit numbers in column A. These item numbers have
got the following make-up:
##-###-##-##

I now would like to assign conditional formatting to the whole column
A with the following condition: As soon as the entered number does not
match the above syntax, the cell is to be filled red.

Is that possible?

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      2nd Nov 2009
Give this Conditional Formatting formula a try...

=AND(A1<>"",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1,
"-", ""), "##-###-##-##") <> A1))

--
Rick (MVP - Excel)


"andreashermle" <(E-Mail Removed)> wrote in message
news:513ab1ce-ea57-4550-83c0-(E-Mail Removed)...
> Dear Experts:
>
> I need to enter 9 digit numbers in column A. These item numbers have
> got the following make-up:
> ##-###-##-##
>
> I now would like to assign conditional formatting to the whole column
> A with the following condition: As soon as the entered number does not
> match the above syntax, the cell is to be filled red.
>
> Is that possible?
>
> Help is much appreciated. Thank you very much in advance.
>
> Regards, Andreas


 
Reply With Quote
 
MRT
Guest
Posts: n/a
 
      2nd Nov 2009
......OR(LENB(A1)<>12,NOT..... :-)

--
MRT

"Rick Rothstein" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Give this Conditional Formatting formula a try...
>
> =AND(A1<>"",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1,
> "-", ""), "##-###-##-##") <> A1))
>
> --
> Rick (MVP - Excel)
>
>
> "andreashermle" <(E-Mail Removed)> wrote in message
> news:513ab1ce-ea57-4550-83c0-(E-Mail Removed)...
>> Dear Experts:
>>
>> I need to enter 9 digit numbers in column A. These item numbers have
>> got the following make-up:
>> ##-###-##-##
>>
>> I now would like to assign conditional formatting to the whole column
>> A with the following condition: As soon as the entered number does not
>> match the above syntax, the cell is to be filled red.
>>
>> Is that possible?
>>
>> Help is much appreciated. Thank you very much in advance.
>>
>> Regards, Andreas

>

 
Reply With Quote
 
Tom Hutchins
Guest
Posts: n/a
 
      2nd Nov 2009
One way...

Format column A with a custom format: ##-###-##-##
Select column A. Select Format >> Conditional Formatting. Change 'Cell Value
Is' to 'Formula Is' and enter this formula in the box next to it:

=(OR(LEN(A1)=0,ISNUMBER(A1)=TRUE))=FALSE

Click the Format button. On the Patterns tab, click red. Click OK to close
the Format dialog, then OK again to close the Conditional Formatting dialog.

These directions are based on Excel 2003. I don't have 2007 available at the
moment, but the steps are similar. You need to add a rule based on a formula
(the formula above).

With the above custom format and conditional formatting in place, your users
will enter the digits only - the custom format will put in the dashes.
Missing, extraneuous, or invalid characters will cause the conditional
formatting to kick in and highlight the field.

Hope this helps,

Hutch

"andreashermle" wrote:

> Dear Experts:
>
> I need to enter 9 digit numbers in column A. These item numbers have
> got the following make-up:
> ##-###-##-##
>
> I now would like to assign conditional formatting to the whole column
> A with the following condition: As soon as the entered number does not
> match the above syntax, the cell is to be filled red.
>
> Is that possible?
>
> Help is much appreciated. Thank you very much in advance.
>
> Regards, Andreas
> .
>

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      2nd Nov 2009
Won't that highlight all the blank cells in the conditionally formatted
range?

--
Rick (MVP - Excel)


"MRT" <(E-Mail Removed)> wrote in message
news:e$(E-Mail Removed)...
> .....OR(LENB(A1)<>12,NOT..... :-)
>
> --
> MRT
>
> "Rick Rothstein" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Give this Conditional Formatting formula a try...
>>
>> =AND(A1<>"",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1,
>> "-", ""), "##-###-##-##") <> A1))
>>
>> --
>> Rick (MVP - Excel)
>>
>>
>> "andreashermle" <(E-Mail Removed)> wrote in message
>> news:513ab1ce-ea57-4550-83c0-(E-Mail Removed)...
>>> Dear Experts:
>>>
>>> I need to enter 9 digit numbers in column A. These item numbers have
>>> got the following make-up:
>>> ##-###-##-##
>>>
>>> I now would like to assign conditional formatting to the whole column
>>> A with the following condition: As soon as the entered number does not
>>> match the above syntax, the cell is to be filled red.
>>>
>>> Is that possible?
>>>
>>> Help is much appreciated. Thank you very much in advance.
>>>
>>> Regards, Andreas

>>


 
Reply With Quote
 
Tom Hutchins
Guest
Posts: n/a
 
      2nd Nov 2009
Brilliant! Let me just add that if the codes might begin with zero, an
additional test should be added to Rick's conditional formatting formula:

=AND(A1<>"",LEFT(A1,1)<>"0",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1, "-", ""), "##-###-##-##") <> A1))

Hutch

"Rick Rothstein" wrote:

> Give this Conditional Formatting formula a try...
>
> =AND(A1<>"",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1,
> "-", ""), "##-###-##-##") <> A1))
>
> --
> Rick (MVP - Excel)
>
>
> "andreashermle" <(E-Mail Removed)> wrote in message
> news:513ab1ce-ea57-4550-83c0-(E-Mail Removed)...
> > Dear Experts:
> >
> > I need to enter 9 digit numbers in column A. These item numbers have
> > got the following make-up:
> > ##-###-##-##
> >
> > I now would like to assign conditional formatting to the whole column
> > A with the following condition: As soon as the entered number does not
> > match the above syntax, the cell is to be filled red.
> >
> > Is that possible?
> >
> > Help is much appreciated. Thank you very much in advance.
> >
> > Regards, Andreas

>
> .
>

 
Reply With Quote
 
andreashermle
Guest
Posts: n/a
 
      2nd Nov 2009
On 2 Nov., 16:00, "Rick Rothstein"
<rick.newsNO.S...@NO.SPAMverizon.net> wrote:
> Give this Conditional Formatting formula a try...
>
> =AND(A1<>"",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1,
> "-", ""), "##-###-##-##") <> A1))
>
> --
> Rick (MVP - Excel)
>
> "andreashermle" <andreas.her...@gmx.de> wrote in message
>
> news:513ab1ce-ea57-4550-83c0-(E-Mail Removed)...
>
>
>
> > Dear Experts:

>
> > I need to enter 9 digit numbers in column A. These item numbers have
> > got the following make-up:
> > ##-###-##-##

>
> > I now would like to assign conditional formatting to the whole column
> > A with the following condition: As soon as the entered number does not
> > match the above syntax, the cell is to be filled red.

>
> > Is that possible?

>
> > Help is much appreciated. Thank you very much in advance.

>
> > Regards, Andreas- Zitierten Text ausblenden -

>
> - Zitierten Text anzeigen -


Hi Rick,

great, what a code. It works as desired. Thank you for your superb /
professional help. I really appreciate it. Regards, Andreas
 
Reply With Quote
 
Tom Hutchins
Guest
Posts: n/a
 
      2nd Nov 2009
That revision is wrong (would allow 0A-234-56-78 to pass), but both Risk's
formula & mine cause any code beginning with zero (such as 01-234-56-78) to
fail.

Hutch

"Tom Hutchins" wrote:

> Brilliant! Let me just add that if the codes might begin with zero, an
> additional test should be added to Rick's conditional formatting formula:
>
> =AND(A1<>"",LEFT(A1,1)<>"0",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1, "-", ""), "##-###-##-##") <> A1))
>
> Hutch
>
> "Rick Rothstein" wrote:
>
> > Give this Conditional Formatting formula a try...
> >
> > =AND(A1<>"",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1,
> > "-", ""), "##-###-##-##") <> A1))
> >
> > --
> > Rick (MVP - Excel)
> >
> >
> > "andreashermle" <(E-Mail Removed)> wrote in message
> > news:513ab1ce-ea57-4550-83c0-(E-Mail Removed)...
> > > Dear Experts:
> > >
> > > I need to enter 9 digit numbers in column A. These item numbers have
> > > got the following make-up:
> > > ##-###-##-##
> > >
> > > I now would like to assign conditional formatting to the whole column
> > > A with the following condition: As soon as the entered number does not
> > > match the above syntax, the cell is to be filled red.
> > >
> > > Is that possible?
> > >
> > > Help is much appreciated. Thank you very much in advance.
> > >
> > > Regards, Andreas

> >
> > .
> >

 
Reply With Quote
 
Tom Hutchins
Guest
Posts: n/a
 
      2nd Nov 2009
Using 0 instead of # in the TEXT function seems to handle leading zeros
without causing new problems:

=AND(A10<>"",OR(NOT(ISNUMBER(--SUBSTITUTE(A10,"-",""))),TEXT(SUBSTITUTE(A10,
"-", ""), "00-000-00-00") <> A10))

Sorry for all the posts. Doing too many things at once.

Hutch

"Tom Hutchins" wrote:

> That revision is wrong (would allow 0A-234-56-78 to pass), but both Risk's
> formula & mine cause any code beginning with zero (such as 01-234-56-78) to
> fail.
>
> Hutch
>
> "Tom Hutchins" wrote:
>
> > Brilliant! Let me just add that if the codes might begin with zero, an
> > additional test should be added to Rick's conditional formatting formula:
> >
> > =AND(A1<>"",LEFT(A1,1)<>"0",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1, "-", ""), "##-###-##-##") <> A1))
> >
> > Hutch
> >
> > "Rick Rothstein" wrote:
> >
> > > Give this Conditional Formatting formula a try...
> > >
> > > =AND(A1<>"",OR(NOT(ISNUMBER(--SUBSTITUTE(A1,"-",""))),TEXT(SUBSTITUTE(A1,
> > > "-", ""), "##-###-##-##") <> A1))
> > >
> > > --
> > > Rick (MVP - Excel)
> > >
> > >
> > > "andreashermle" <(E-Mail Removed)> wrote in message
> > > news:513ab1ce-ea57-4550-83c0-(E-Mail Removed)...
> > > > Dear Experts:
> > > >
> > > > I need to enter 9 digit numbers in column A. These item numbers have
> > > > got the following make-up:
> > > > ##-###-##-##
> > > >
> > > > I now would like to assign conditional formatting to the whole column
> > > > A with the following condition: As soon as the entered number does not
> > > > match the above syntax, the cell is to be filled red.
> > > >
> > > > Is that possible?
> > > >
> > > > Help is much appreciated. Thank you very much in advance.
> > > >
> > > > Regards, Andreas
> > >
> > > .
> > >

 
Reply With Quote
 
andreashermle
Guest
Posts: n/a
 
      2nd Nov 2009
On 2 Nov., 16:46, Tom Hutchins <TomHutch...@discussions.microsoft.com>
wrote:
> One way...
>
> Format column A with a custom format: ##-###-##-##
> Select column A. Select Format >> Conditional Formatting. Change 'Cell Value
> Is' to 'Formula *Is' and enter this formula in the box next to it:
>
> =(OR(LEN(A1)=0,ISNUMBER(A1)=TRUE))=FALSE
>
> Click the Format button. On the Patterns tab, click red. Click OK to close
> the Format dialog, then OK again to close the Conditional Formatting dialog.
>
> These directions are based on Excel 2003. I don't have 2007 available at the
> moment, but the steps are similar. You need to add a rule based on a formula
> (the formula above).
>
> With the above custom format and conditional formatting in place, your users
> will enter the digits only - the custom format will put in the dashes.
> Missing, extraneuous, or invalid characters will cause the conditional
> formatting to kick in and highlight the field.
>
> Hope this helps,
>
> Hutch
>
>
>
> "andreashermle" wrote:
> > Dear Experts:

>
> > I need to enter 9 digit numbers in column A. These item numbers have
> > got the following make-up:
> > ##-###-##-##

>
> > I now would like to assign conditional formatting to the whole column
> > A with the following condition: As soon as the entered number does not
> > match the above syntax, the cell is to be filled red.

>
> > Is that possible?

>
> > Help is much appreciated. Thank you very much in advance.

>
> > Regards, Andreas
> > .- Zitierten Text ausblenden -

>
> - Zitierten Text anzeigen -


Hi Tom,

I am afraid to tell you that your effort did not produce the desired
result. Anyhow, I really appreciate your taking the time to help me.
Thank you. Rick's formula works as desired. Any number or string other
than ##-###-##-## hightlights the cell red with Rick's formula.

Regards, Andreas
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting according to the date the data is entered hadeeter Microsoft Excel Misc 1 6th May 2010 08:16 PM
entering 16 digit numbers - last digit turns to zero dreamer Microsoft Excel New Users 4 9th May 2009 01:04 AM
conditional format on first & last digit on 3 digit cell data caprey Microsoft Excel New Users 3 17th Dec 2008 05:24 PM
Formatting Numbers to 3 digit, Raz Microsoft Excel Misc 3 9th Oct 2008 11:55 PM
Change 2 digit suffix in 14 digit number in a column of numbers. Brad H. Microsoft Excel Worksheet Functions 1 4th Sep 2003 04:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:55 PM.