Formula to identify if for a unique identifier there is more than one value in another column

vanbooth

New Member
Joined
Apr 3, 2017
Messages
15
I have two columns of data, one contains a unique identifier, the other contains another 4 digit key.

What I want to do is for the unique identifier when there is more than one 4 digit key that is associated to it, I would like to to display x. Marking both entries not just the first or second. For example:

4 digit KeyUnique IdentifierDuplicate
PL01AB
BE01ABC
BE01ABCD
BE01ABCDEx
FR05ABCDEx
BE01ABCDEFx
GB30ABCDEFx
GB30ABCDEFG
PL01ABCDEFGH
GB30ABCDEFGHIx
PL01ABCDEFGHIx

<tbody>
</tbody>


Does anyone have any suggestions for how to best tackle this?

TIA
 
When I copy and paste the formula into a new sheet to test it with the same data set it provides an 'x' for all the data.

I think this is because it does not appear to be referencing column A at all. It needs to lookup the value in column A from the value in column B to see if two values found in column A. If two values are found it needs to identify in column C beside both entries with an x. If the value in column B has only one corresponding value in column A it should be blank.

Does that help explain better?

TIA

Try to post an illustrative sample...
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Thanks for the reply I provided a more accurate data set after to Ali's reply - found here:

BE01ILD-S1933-UTZ-0002341223412
BE01ISW-K6138-SPT-0001902019020
BE01YPW-F120001-05-00011871187
BE01YYD-A16NH-UTZ-000132248367
FR05CHD-Q15NOP-UTZ-0001523431162
BE01BAK-D1NV-0002341223412
BE01CHD-Q70SDO-0005611756117x
FR05CHD-Q70SDO-0005611756117x
BE01CHD-T6436-UTZ-00089261313
BE01CHD-U2431-UTZ-0001024157
BE01CHD-U4830NVUTZ-0002937629376
BE01CHD-U5431BO2FT-000102446755
BE01CHD-V9124-000102446755
BE01CHM-U23S-00030903090x
GB30CHM-U23S-00030903090x
GB30CHM-V8071-000375766100
GB30CHM-W8069-000375766100
GB30CVW-U16USP-NES-00030903090x
PL01CVW-U16USP-NES-00030903090x
GB30CVW-U16USP-NES-000390016545x
PL01CVW-U16USP-NES-000390016545x
GB30FAIR-M4GB-0004701918221
GB30FAIR-M4GB-0004701939911

<colgroup><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
In C2 control+shift+enter, not just enter, and copy down:

=IF(SUM(IF(FREQUENCY(IF($B$2:$B$24=B2,MATCH($A$2:$A$24,$A$2:$A$24,0)),ROW($A$2:$A$24)-ROW($A$2)+1),1))>1,"x","")
 
Upvote 0
In C2 control+shift+enter, not just enter, and copy down:

=IF(SUM(IF(FREQUENCY(IF($B$2:$B$24=B2,MATCH($A$2:$A$24,$A$2:$A$24,0)),ROW($A$2:$A$24)-ROW($A$2)+1),1))>1,"x","")


Thank you so much! Is there a way to do it for all of column A and column B, the list of data will vary each time

TIA
 
Upvote 0
Thank you so much! Is there a way to do it for all of column A and column B, the list of data will vary each time

TIA

Two options:

1. Convert the data are into a table (Insert | Table)

Then in C2 control+shift+enter, not just enter, and copy down:

=IF(SUM(IF(FREQUENCY(IF([Concatenate]=B2,MATCH([Key],[Key],0)),ROW([Key])-ROW(INDEX([Key],1,1))+1),1))>1,"x","")

2. Define the following names in Formulas | Name Manager...

Key as referring to:

=Sheet1!$A$2:INDEX(Sheet1!$A:$A,MATCH(REPT("z",255),Sheet1!$A:$A))

Concat
as referring to:

=Sheet1!$B$2:INDEX(Sheet1!$B:$B,MATCH(REPT("z",255),Sheet1!$A:$A))

Now in C2 control+shift+enter, not just enter, and copy down:

=IF(SUM(IF(FREQUENCY(IF(Concat=B2,MATCH(Key,Key,0)),ROW(Key)-ROW(INDEX(Key,1,1))+1),1))>1,"x","")
 
Upvote 0
Two options:

1. Convert the data are into a table (Insert | Table)

Then in C2 control+shift+enter, not just enter, and copy down:

=IF(SUM(IF(FREQUENCY(IF([Concatenate]=B2,MATCH([Key],[Key],0)),ROW([Key])-ROW(INDEX([Key],1,1))+1),1))>1,"x","")

2. Define the following names in Formulas | Name Manager...

Key as referring to:

=Sheet1!$A$2:INDEX(Sheet1!$A:$A,MATCH(REPT("z",255),Sheet1!$A:$A))

Concat
as referring to:

=Sheet1!$B$2:INDEX(Sheet1!$B:$B,MATCH(REPT("z",255),Sheet1!$A:$A))

Now in C2 control+shift+enter, not just enter, and copy down:

=IF(SUM(IF(FREQUENCY(IF(Concat=B2,MATCH(Key,Key,0)),ROW(Key)-ROW(INDEX(Key,1,1))+1),1))>1,"x","")



Thank you! I went with option two and defined the names - in C2 I can't seem to get the Ctrl+shift+enter to work. When I paste into the formula bar and Ctrl+shift+enter it just takes me to C3. I did notice when I click back on the formula in C2 in the formula bar it displays as {=IF(SUM(IF(FREQUENCY(IF(Concat=B2,MATCH(Key,Key,0)),ROW(Key)-ROW(INDEX(Key,1,1))+1),1))>1,"x","")} but when you click back in the formula bar the {} dissapear.

What am I doing wrong?

Thanks again!
 
Upvote 0
Maybe I'm misinterpreting here but isn't this just a condition based on a COUNTIFS?


Book1
ABC
1BE01ILD-S1933-UTZ-0002341223412 
2BE01ISW-K6138-SPT-0001902019020
3BE01YPW-F120001-05-00011871187
4BE01YYD-A16NH-UTZ-000132248367
5FR05CHD-Q15NOP-UTZ-0001523431162
6BE01BAK-D1NV-0002341223412
7BE01CHD-Q70SDO-0005611756117x
8FR05CHD-Q70SDO-0005611756117x
9BE01CHD-T6436-UTZ-00089261313
10BE01CHD-U2431-UTZ-0001024157
11BE01CHD-U4830NVUTZ-0002937629376
12BE01CHD-U5431BO2FT-000102446755
13BE01CHD-V9124-000102446755
14BE01CHM-U23S-00030903090x
15GB30CHM-U23S-00030903090x
16GB30CHM-V8071-000375766100
17GB30CHM-W8069-000375766100
18GB30CVW-U16USP-NES-00030903090x
19PL01CVW-U16USP-NES-00030903090x
20GB30CVW-U16USP-NES-000390016545x
21PL01CVW-U16USP-NES-000390016545x
22GB30FAIR-M4GB-0004701918221
23GB30FAIR-M4GB-0004701939911
Sheet1
Cell Formulas
RangeFormula
C1=IF(COUNTIFS($B$1:$B$23,$B1,$A$1:$A$23,"<>"&$A1)=0,"","x")


WBD
 
Upvote 0
Actually that sounds like a simpler way to do it - any way to expand that to be all of column A and B?

TIA!
 
Upvote 0

Forum statistics

Threads
1,216,523
Messages
6,131,151
Members
449,626
Latest member
Stormythebandit

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top