I have a single column. If I enter this code into the validation, It does what I want. It constrains the entries so that they start with either "PCO-R0343-" or "DVCO-R0343-".
=OR(AND(LEN(A5)=14,EXACT(LEFT(A5,10),"PCO-R0343-"),ISNUMBER(-MID(A5,ROW(INDIRECT("11:14")),1))),AND(LEN(A5)=15,EXACT(LEFT(A5,11),"DVCO-R0343-"),ISNUMBER(-MID(A5,ROW(INDIRECT("12:15")),1))))
I also have this code. If I remove all validation code and enter this code, instead, it does what I want. It constrains the entries so that the last four characters cannot be duplicated anywhere in the column.
=AND(COUNTIF($A$5:$A$1005,"*-R0343-"&RIGHT(A5,4))=1)
But, If I enter this code (the two prior codes merged together) it's as if the red code is ignored and the blue code is all that's being "enforced".
=OR(AND(LEN(A5)=14,EXACT(LEFT(A5,10),"PCO-R0343-"),ISNUMBER(-MID(A5,ROW(INDIRECT("11:14")),1))),AND(LEN(A5)=15,EXACT(LEFT(A5,11),"DVCO-R0343-"),ISNUMBER(-MID(A5,ROW(INDIRECT("12:15")),1))),AND(COUNTIF($A$5:$A$1005,"*-R0343-"&RIGHT(A5,4))=1))
Does anyone see what may be causing one formula to override the other one?
I thank you in advance for all of your time and effort!
Edit:
I am limited by the number of characters, or I would add in place of the blue code: (COUNTIF($A$5:$A$1005,"PCO-R0343-"&RIGHT(A5,4))=1) and (COUNTIF($A$5:$A$1005,"DVCO-R0343-"&RIGHT(A5,4))=1)
=OR(AND(LEN(A5)=14,EXACT(LEFT(A5,10),"PCO-R0343-"),ISNUMBER(-MID(A5,ROW(INDIRECT("11:14")),1))),AND(LEN(A5)=15,EXACT(LEFT(A5,11),"DVCO-R0343-"),ISNUMBER(-MID(A5,ROW(INDIRECT("12:15")),1))))
I also have this code. If I remove all validation code and enter this code, instead, it does what I want. It constrains the entries so that the last four characters cannot be duplicated anywhere in the column.
=AND(COUNTIF($A$5:$A$1005,"*-R0343-"&RIGHT(A5,4))=1)
But, If I enter this code (the two prior codes merged together) it's as if the red code is ignored and the blue code is all that's being "enforced".
=OR(AND(LEN(A5)=14,EXACT(LEFT(A5,10),"PCO-R0343-"),ISNUMBER(-MID(A5,ROW(INDIRECT("11:14")),1))),AND(LEN(A5)=15,EXACT(LEFT(A5,11),"DVCO-R0343-"),ISNUMBER(-MID(A5,ROW(INDIRECT("12:15")),1))),AND(COUNTIF($A$5:$A$1005,"*-R0343-"&RIGHT(A5,4))=1))
Does anyone see what may be causing one formula to override the other one?
I thank you in advance for all of your time and effort!
Edit:
I am limited by the number of characters, or I would add in place of the blue code: (COUNTIF($A$5:$A$1005,"PCO-R0343-"&RIGHT(A5,4))=1) and (COUNTIF($A$5:$A$1005,"DVCO-R0343-"&RIGHT(A5,4))=1)
Last edited: