View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pete pete is offline
external usenet poster
 
Posts: 11
Default Help needed: Conditional Formatting for 3 columns, any two of whichmust have data

I have 3 columns, A, B, and C. Each will accept input of exactly 6 alphanumeric characters. Two of the three must be populated.

The Conditional Formatting is used to highlight columns which are not compliant.

I've got one for the 6 characters required (spaces before and after the strings are ignored):

=OR(LEN(TRIM(A1))6,AND(LEN(TRIM(B1))0,LEN(TRIM(C 1))<6))

And I've got formulas for error states when none or all of the columns are populated:

=AND(LEN(TRIM(A1))=0,LEN(TRIM(B1))=0,LEN(TRIM(C1)) =0)

=AND(LEN(TRIM(A1))0,LEN(TRIM(B1))0,LEN(TRIM(C1)) 0)

But my formula for ensuring that 2 of the columns are populated gets fooled by spaces in the columns, which should be ignored:

=COUNTBLANK(A1:C1)<2

My only alternative that i can think of is to do a fairly complicated AND OR formula with all of the acceptable combinations of the 3 columns.

I'm guessing there's a much more elegant, simple option?