SOLVED

Data Validation - Multiple criteria

%3CLINGO-SUB%20id%3D%22lingo-sub-1419126%22%20slang%3D%22en-US%22%3EData%20Validation%20-%20Multiple%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1419126%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20setting%20up%20a%20log%20sheet%20in%20Excel%20for%20product%20lot%20numbers.%20The%20format%20is%20stipulated%20by%20the%20customer%2C%20so%20that%20cannot%20be%20changed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20format%20must%20be%20as%20follows%3A%3C%2FP%3E%3CP%3E2%20numbers%20%2B%201%20alpha%20%2B%202%20numbers%20%2B%201%20alpha%20(always%20E)%20%2B%202%20numbers.%20(%23%23%3F%23%23E%23%23)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAND%20the%20resulting%20string%20must%20be%20UNIQUE.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20read%20through%20everything%20I%20can%20find%20on%20data%20validation%20and%20can't%20seem%20to%20come%20up%20with%20the%20formula%20that%20gets%20this%20done.%20I'm%20really%20missing%20my%20Access%20tools.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%2C%20community%20for%20your%20help%20with%20this%20puzzle!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1419126%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1419165%22%20slang%3D%22en-US%22%3ERe%3A%20Data%20Validation%20-%20Multiple%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1419165%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146495%22%20target%3D%22_blank%22%3E%40Colleen%20Kayter%3C%2FA%3E%26nbsp%3BI%20think%20the%20instructions%20on%20%22Prevent%20duplicates%20in%20Ranges%20of%20cells%22%3C%2FP%3E%3CP%3Eat%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.contextures.com%2FxlDataVal07.html%23duprange%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.contextures.com%2FxlDataVal07.html%23duprange%26nbsp%3B%3C%2FA%3Emay%20help%20you%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1419600%22%20slang%3D%22en-US%22%3ERe%3A%20Data%20Validation%20-%20Multiple%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1419600%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146495%22%20target%3D%22_blank%22%3E%40Colleen%20Kayter%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAssuming%20the%20entries%20in%20question%20are%20all%20in%20column%20A%20and%20that%20the%20first%20cell%20to%20which%20you%20wish%20to%20apply%20the%20validation%20is%20cell%20A1%2C%20then%2C%20with%20the%20active%20cell%20somewhere%20in%20row%201%2C%20go%20to%20Name%20Manager%20(%3CEM%3EFormulas%3C%2FEM%3E%20tab)%20and%20define%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EName%3C%2FEM%3E%3A%26nbsp%3B%3CFONT%20color%3D%22%23000080%22%3E%3CSTRONG%3EMyValidation%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CEM%3ERefers%20to%3C%2FEM%3E%3A%26nbsp%3B%3CFONT%20color%3D%22%23000080%22%3E%3CSTRONG%3E%3DAND(LEN(%24A1)%3D8%2C1-ISERR(0%2BMID(%24A1%2C%7B1%2C2%2C4%2C5%2C7%2C8%7D%2C1))%2CEXACT(MID(%24A1%2C6%2C1)%2C%22E%22)%2CABS(77.5-CODE(MID(%24A1%2C3%2C1)))%26lt%3B13%2CCOUNTIF(%24A%3A%24A%2C%24A1)%3D1)%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAfter%20which%20you%20can%20apply%20data%20validation%20to%20cell%20A1%20choosing%20'Custom'%20in%20the%20%3CEM%3EAllow%3C%2FEM%3E%20box%20and%20entering%20the%20following%20in%20the%20%3CEM%3EFormula%3C%2FEM%3E%20box%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000080%22%3E%3CSTRONG%3E%3DMyValidation%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMake%20sure%20you%20also%20%3CSTRONG%3Euncheck%3C%2FSTRONG%3E%20the%20%3CEM%3EIgnore%20blank%3C%2FEM%3E%20box.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20small%20point%2C%20but%20if%20you%20are%20intending%20to%20use%20the%20%3CEM%3ECircle%20Invalid%20Data%3C%2FEM%3E%20tool%20to%20audit%20incorrect%20entries%2C%20just%20be%20aware%20that%20any%20cells%20to%20which%20you%20extend%20the%20data%20validation%20and%20which%20are%20blank%20will%20be%20circled%20as%20invalid.%20If%20this%20is%20not%20desirable%20I%20can%20provide%20you%20with%20an%20amended%20solution.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EN.B.%20You%20didn't%20say%2C%20but%20I%20presumed%20that%20the%20two%20alphabetic%20characters%20both%20have%20to%20be%20upper%20case.%20The%20current%20validation%20disallows%20lower%20case.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1421671%22%20slang%3D%22en-US%22%3ERe%3A%20Data%20Validation%20-%20Multiple%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1421671%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F676180%22%20target%3D%22_blank%22%3E%40Jos_Woolley%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%2C%20Jos.%20You%20are%20my%20hero!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1421705%22%20slang%3D%22en-US%22%3ERe%3A%20Data%20Validation%20-%20Multiple%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1421705%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146495%22%20target%3D%22_blank%22%3E%40Colleen%20Kayter%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENice%20to%20know!%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

I am setting up a log sheet in Excel for product lot numbers. The format is stipulated by the customer, so that cannot be changed.

 

The format must be as follows:

2 numbers + 1 alpha + 2 numbers + 1 alpha (always E) + 2 numbers. (##?##E##)

 

AND the resulting string must be UNIQUE.

 

I've read through everything I can find on data validation and can't seem to come up with the formula that gets this done. I'm really missing my Access tools.

 

Thank you, community for your help with this puzzle!

4 Replies
Highlighted

@Colleen Kayter I think the instructions on "Prevent duplicates in Ranges of cells"

at https://www.contextures.com/xlDataVal07.html#duprange may help you

Highlighted
Best Response confirmed by Colleen Kayter (Contributor)
Solution

@Colleen Kayter 

 

Hi,

 

Assuming the entries in question are all in column A and that the first cell to which you wish to apply the validation is cell A1, then, with the active cell somewhere in row 1, go to Name Manager (Formulas tab) and define:

 

NameMyValidation

Refers to=AND(LEN($A1)=8,1-ISERR(0+MID($A1,{1,2,4,5,7,8},1)),EXACT(MID($A1,6,1),"E"),ABS(77.5-CODE(MID($A1,3,1)))<13,COUNTIF($A:$A,$A1)=1)

 

After which you can apply data validation to cell A1 choosing 'Custom' in the Allow box and entering the following in the Formula box:

 

=MyValidation

 

Make sure you also uncheck the Ignore blank box.

 

A small point, but if you are intending to use the Circle Invalid Data tool to audit incorrect entries, just be aware that any cells to which you extend the data validation and which are blank will be circled as invalid. If this is not desirable I can provide you with an amended solution.

 

N.B. You didn't say, but I presumed that the two alphabetic characters both have to be upper case. The current validation disallows lower case.

 

Regards

Highlighted

@Jos_Woolley 

 

Thank you, Jos. You are my hero!

Highlighted

@Colleen Kayter 

 

Nice to know!