SOLVED

Data Validation on column with concatenated cells

%3CLINGO-SUB%20id%3D%22lingo-sub-1588787%22%20slang%3D%22en-US%22%3EData%20Validation%20on%20column%20with%20concatenated%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1588787%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20use%20data%20validation%20on%20a%20column%20which%20has%20a%20concatenated%20formula%20combining%203%20cells%20from%20other%20columns%20to%20ensure%20that%20the%20combined%20data%20is%20unique%20(i.e.%20columns%20A%2CB%20%2B%20C%20can%20have%20many%20duplicated%2C%20but%20the%20combined%20data%20of%20of%20Columns%20A%2C%20B%20%2BC%20must%20be%20unique).%20However%2C%20the%20validation%20doesn't%20work%2C%20I%20think%20because%20the%20data%20in%20the%20column%20requiring%20validation%20is%20made%20using%20a%20formula.%3C%2FP%3E%3CP%3EIs%20there%20any%20way%20round%20this%2C%20or%20other%20means%20of%20ensuring%20that%20a%20combination%20of%20cells%20is%20unique%3F%3C%2FP%3E%3CP%3EI%20have%20attached%20a%20file%20for%20info.%20The%20column%20I%20am%20trying%20to%20validate%20is%20AW%20on%20the%20Drawing%20Issue%20Register%20worksheet%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1588787%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-1588822%22%20slang%3D%22en-US%22%3ERe%3A%20Data%20Validation%20on%20column%20with%20concatenated%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1588822%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F759505%22%20target%3D%22_blank%22%3E%40Steverm25%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EData%20validation%20only%20works%20on%20cells%20that%20are%20edited%20directly%2C%20not%20on%20cells%20containing%20a%20formula.%3C%2FP%3E%0A%3CP%3EBut%20columns%20A%20and%20B%20already%20have%20data%20validation%20of%20type%20List%20to%20display%20a%20dropdown%20list.%20You%20cannot%20add%20data%20validation%20to%20check%20for%20uniqueness.%3C%2FP%3E%0A%3CP%3EYou%20could%20add%20a%20validation%20rule%20to%20column%20C%20of%20type%20custom%2C%20with%20formula%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DCOUNTIF(%24AW%242%3A%24AW%2472%2C%24AW2)%3D1%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20will%20prevent%20you%20from%20entering%20a%20value%20in%20column%20C%20that%20would%20cause%20a%20duplicate%20combination%20of%20A.%20B%20and%20C.%3C%2FP%3E%0A%3CP%3EBut%20unfortunately%2C%20it%20won't%20prevent%20you%20from%20changing%20column%20A%20or%20B%20to%20create%20a%20duplicate%20combination.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAn%20alternative%20would%20be%20to%20write%20VBA%20for%20the%20Worksheet_Change%20event%2C%20but%20that%20might%20be%20overkill%2C%20and%20it%20would%20disable%20Undo.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1588857%22%20slang%3D%22en-US%22%3ERe%3A%20Data%20Validation%20on%20column%20with%20concatenated%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1588857%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20Hans.%20I%20appreciate%20that%20is%20where%20the%20problem%20is.%20Columns%20A%2C%20B%20%2B%20C%20individually%20don't%20need%20to%20(and%20can't%20be)%20unique.%20It%20is%20only%20the%20combined%20information%20that%20make%20up%20a%20drawing%20number%20(e.g.%20G(0-)01)%20that%20has%20to%20be%20unique%20(i.e.%20I%20can't%20have%20to%20drawing%20number%20the%20same).%3C%2FP%3E%3CP%3Eas%20a%20set%20of%20examples%3A%3C%2FP%3E%3CP%3EG(0-)01%20-ok%3C%2FP%3E%3CP%3EG(0-)02%20-%20ok%3C%2FP%3E%3CP%3EG(2-)01%20-%20ok%3C%2FP%3E%3CP%3EA(0-)01%20-%20ok%3C%2FP%3E%3CP%3EBut%20a%20further%20copy%20of%20the%20same%20data%20(e.g.%20another%20G(0-)01%20%2C%20not%20ok)%3C%2FP%3E%3CP%3EIt%20looks%20like%20VBA%20may%20have%20to%20be%20the%20way%20to%20go%2C%20but%20disabling%20undo%20would%20be%20unacceptable).%20Otherwise%2C%20might%20just%20have%20to%20live%20with%20being%20careful%20and%20checking%20manually%20for%20duplicates.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1588864%22%20slang%3D%22en-US%22%3ERe%3A%20Data%20Validation%20on%20column%20with%20concatenated%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1588864%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F759505%22%20target%3D%22_blank%22%3E%40Steverm25%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECreating%20the%20data%20validation%20rule%20on%20column%20C%20based%20on%20column%20AW%20as%20described%20in%20my%20previous%20reply%20will%20help%20-%20I%20assume%20that%20you%20will%20mostly%20enter%20a%20value%20there%20after%20entering%20a%20value%20in%20columns%20A%20and%20B.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

I am trying to use data validation on a column which has a concatenated formula combining 3 cells from other columns to ensure that the combined data is unique (i.e. columns A,B + C can have many duplicated, but the combined data of of Columns A, B +C must be unique). However, the validation doesn't work, I think because the data in the column requiring validation is made using a formula.

Is there any way round this, or other means of ensuring that a combination of cells is unique?

I have attached a file for info. The column I am trying to validate is AW on the Drawing Issue Register worksheet

3 Replies
Highlighted

@Steverm25 

Data validation only works on cells that are edited directly, not on cells containing a formula.

But columns A and B already have data validation of type List to display a dropdown list. You cannot add data validation to check for uniqueness.

You could add a validation rule to column C of type custom, with formula

 

=COUNTIF($AW$2:$AW$72,$AW2)=1

 

This will prevent you from entering a value in column C that would cause a duplicate combination of A. B and C.

But unfortunately, it won't prevent you from changing column A or B to create a duplicate combination.

 

An alternative would be to write VBA for the Worksheet_Change event, but that might be overkill, and it would disable Undo.

Highlighted
Best Response confirmed by Hans Vogelaar (MVP)
Solution

@Hans Vogelaar 

Thanks Hans. I appreciate that is where the problem is. Columns A, B + C individually don't need to (and can't be) unique. It is only the combined information that make up a drawing number (e.g. G(0-)01) that has to be unique (i.e. I can't have to drawing number the same).

as a set of examples:

G(0-)01 -ok

G(0-)02 - ok

G(2-)01 - ok

A(0-)01 - ok

But a further copy of the same data (e.g. another G(0-)01 , not ok)

It looks like VBA may have to be the way to go, but disabling undo would be unacceptable). Otherwise, might just have to live with being careful and checking manually for duplicates.

Highlighted

@Steverm25 

Creating the data validation rule on column C based on column AW as described in my previous reply will help - I assume that you will mostly enter a value there after entering a value in columns A and B.