SOLVED

Hide other duplicates using cond formatting + IF function based on x in adjacent cell

%3CLINGO-SUB%20id%3D%22lingo-sub-3070326%22%20slang%3D%22en-US%22%3EHide%20other%20duplicates%20using%20cond%20formatting%20%2B%20IF%20function%20based%20on%20x%20in%20adjacent%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3070326%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3CBR%20%2F%3E%3CBR%20%2F%3EI'm%20working%20on%20a%20personnel%20deployment%20tool%2C%20which%20gives%20me%20a%20list%20of%20names%20under%20specific%20work%20areas.%20However%2C%20some%20operatives%20are%20qualified%20to%20work%20in%20more%20than%20one%20area.%20Therefore%20I'm%20trying%20to%20develop%20a%20tool%20which%20I%20can%20use%20to%20select%20a%20name%20in%20any%20one%20list%20(by%20putting%20an%20'x'%20in%20the%20cell%20next%20to%20it)%2C%20but%20hide%20all%20other%20instances%20of%20it%20in%20the%20other%20lists.%3CBR%20%2F%3E%3CBR%20%2F%3EThere%20may%20be%20more%20than%20one%20instance%20of%20a%20duplicated%20name%2C%20so%20this%20functionality%20needs%20to%20work%20for%20each%20different%20duplicated%20name.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20tried%20to%20figure%20this%20out%20myself%2C%20but%20I%20can%20only%20figure%20the%20constituent%20parts.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20%3DCOUNTIF(%24A%241%3A%24A1%2C%20A1)%26gt%3B1%20function%20highlights%20duplicates.%20I%20can%20use%20conditional%20formatting%20to%20make%20the%20text%20white%2C%20effectively%20hiding%20it.%20And%20I%20can%20use%20the%20IF%20function%20to%20recognise%20an%20adjacent%20cell%2C%20and%20perform%20an%20action%20based%20on%20it.%20I%20just%20can't%20figure%20out%20how%20to%20pull%20all%20this%20together%20in%20the%20example%20below%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22excel%20example.jpg%22%20style%3D%22width%3A%20656px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F341911iFD958FDFFC2A49C2%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22excel%20example.jpg%22%20alt%3D%22excel%20example.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3070326%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-3070520%22%20slang%3D%22en-US%22%3ERe%3A%20Hide%20other%20duplicates%20using%20cond%20formatting%20%2B%20IF%20function%20based%20on%20x%20in%20adjacent%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3070520%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1285258%22%20target%3D%22_blank%22%3E%40mlee147%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESelect%20E2%3AE5%2C%20then%20hold%20down%20Ctrl%20and%20select%20C2%3AC5%2C%20and%20finally%2C%20with%20Ctrl%20still%20held%20down%2C%20select%20A2%3AA5.%20You%20can%20then%20release%20Ctrl.%3C%2FP%3E%0A%3CP%3EA2%20should%20now%20be%20the%20active%20cell%20in%20the%20selection.%3C%2FP%3E%0A%3CP%3ECreate%20a%20conditional%20formatting%20rule%20of%20type%20Formula%20with%20formula%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DAND(B2%3D%22%22%2CCOUNTIF(%24A%242%3A%24E%245%2CA2)%26gt%3B1)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ESee%20the%20attached%20sample%20workbook.%20I%20used%20the%20custom%20number%20format%20%3B%3B%3B%20(three%20semicolons)%20to%20hide%20the%20duplicate%20entries.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi All,

I'm working on a personnel deployment tool, which gives me a list of names under specific work areas. However, some operatives are qualified to work in more than one area. Therefore I'm trying to develop a tool which I can use to select a name in any one list (by putting an 'x' in the cell next to it), but hide all other instances of it in the other lists.

There may be more than one instance of a duplicated name, so this functionality needs to work for each different duplicated name.

I have tried to figure this out myself, but I can only figure the constituent parts.

 

The =COUNTIF($A$1:$A1, A1)>1 function highlights duplicates. I can use conditional formatting to make the text white, effectively hiding it. And I can use the IF function to recognise an adjacent cell, and perform an action based on it. I just can't figure out how to pull all this together in the example below:

excel example.jpg

7 Replies
best response confirmed by mlee147 (Occasional Contributor)
Solution

@mlee147 

Select E2:E5, then hold down Ctrl and select C2:C5, and finally, with Ctrl still held down, select A2:A5. You can then release Ctrl.

A2 should now be the active cell in the selection.

Create a conditional formatting rule of type Formula with formula

=AND(B2="",COUNTIF($A$2:$E$5,A2)>1)

See the attached sample workbook. I used the custom number format ;;; (three semicolons) to hide the duplicate entries.

Hello Hans. Apologies for the late acknowledgement. I couldn't visualise this solution, but it works perfectly - thank you for your kind assistance.
Mike

@Hans Vogelaar 

Hi again,
I've tried to adapt this formula to hide the other names only after the one name is selected. Currently all the duplicate names are hidden until one is selected, but the problem is that you can't see the names to determine which ones to hide!

 

I tried formatting it differently so that the names are greyed out, but it's still too confusing when there's lots of columns to choose names from.

 

Is there a way to make the other names white text (effectively hidden), when one name is selected?

@mlee147 

Use this formula:

=AND(B2="",COUNTIF($A$2:$E$5,A2)>1,COUNTIFS($A$2:$A$5,A2,$B$2:$B$5,"X")+COUNTIFS($C$2:$C$5,A2,$D$2:$D$5,"X")+COUNTIFS($E$2:$E$5,A2,$F$2:$F5,"X"))

See the attached version.

@Hans Vogelaar You're a wonderful human being! Thank you ever so much for your help. It's greatly appreciated.

@Hans Vogelaar 

Apologies, on further checking, this solution only seems to work on the 'Mike's' and not the 'Simon's'?

 

Also, if I add another 'Duplicate Values' conditioning rule, I can use this to highlight the duplicate names. I think this is ok and doesn't appear to stop your original formula from functioning. See attached.

 

Thanks again, and for your patience,

 

Mike

@mlee147 

My apologies - there was a typo. The last $F5 in the formula should be $F$5:

 

=AND(B2="",COUNTIF($A$2:$E$5,A2)>1,COUNTIFS($A$2:$A$5,A2,$B$2:$B$5,"X")+COUNTIFS($C$2:$C$5,A2,$D$2:$D$5,"X")+COUNTIFS($E$2:$E$5,A2,$F$2:$F$5,"X"))