Finding duplicates (horizontally) with formula instead of conditional formattng

Kukorof

New Member
Joined
Oct 16, 2018
Messages
12
Suppose I have data in A2, C2, and E2. And in column F2 i want to show that if any of those three separate cells (it is not a range) have duplicate data horizontally (in a row), then show in F2 "duplicate" if not then show "safe".

How would I do that efficiently without repetitive formula or multiple nested IF functions?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Sorry Forgot to mention that in this case the context given is that A2, C2 and E2 must have data and none of them is blank or "-".
 
Upvote 0
Maybe...

=IF(OR(A2=C2,A2=E2,C2=E2),"Duplicate","Safe")

M.

And what if suppose I wanted to change the condition that the A2 contains data, C2="-", and E2="-", with what formula can I use to verify that the data in A2 is not duplicated in C2 or E2, while ignoring the fact that there is a duplicate of E2=C2="-" ? With what formula could i do that?
 
Upvote 0
Not sure i understand what you need. See if this works

=IF(SUMPRODUCT(--(COUNTIF(A2:E2,A2:E2)*(MOD(COLUMN(A2:E2)-COLUMN(A2)+1,2)=1)*(A2:E2<>"-")>1)),"Duplicate","Safe")

M.
 
Upvote 0
hmm...my formula in post 5 has a flaw

Try this new version
=IF(OR(AND(A2<>"",A2<>"-",A2=C2),AND(A2<>"",A2<>"-",A2=E2),AND(C2<>"",C2<>"-",C2=E2)),"Duplicate","Safe")

M.
 
Upvote 0
Not sure i understand what you need. See if this works

=IF(SUMPRODUCT(--(COUNTIF(A2:E2,A2:E2)*(MOD(COLUMN(A2:E2)-COLUMN(A2)+1,2)=1)*(A2:E2<>"-")>1)),"Duplicate","Safe")

M.

Let me clarify then, supposed i have the following table:

[TABLE="width: 598"]
<colgroup><col span="7"><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 598"]
<colgroup><col span="7"><col></colgroup><tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Data1[/TD]
[TD]Y/N[/TD]
[TD]Data2[/TD]
[TD]Y/N[/TD]
[TD]Data3[/TD]
[TD]Y/N[/TD]
[TD]Duplicate/Safe[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]121[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]133[/TD]
[TD]N[/TD]
[TD]133[/TD]
[TD]N[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]565[/TD]
[TD]N[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD]336[/TD]
[TD]Y[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]778[/TD]
[TD]Y[/TD]
[TD]778[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Now I want only cell G3 and G7 to indicate "Duplicate" the rest in column G should indicate "Safe". With what formula could I do that?

Regards
 
Upvote 0
Let me clarify then, supposed i have the following table:

[TABLE="width: 598"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 598"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Data1[/TD]
[TD]Y/N[/TD]
[TD]Data2[/TD]
[TD]Y/N[/TD]
[TD]Data3[/TD]
[TD]Y/N[/TD]
[TD]Duplicate/Safe[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]121[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]133[/TD]
[TD]N[/TD]
[TD]133[/TD]
[TD]N[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]565[/TD]
[TD]N[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]-[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD]336[/TD]
[TD]Y[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]778[/TD]
[TD]Y[/TD]
[TD]778[/TD]
[TD]Y[/TD]
[TD]-[/TD]
[TD]N[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Now I want only cell G3 and G7 to indicate "Duplicate" the rest in column G should indicate "Safe". With what formula could I do that?

Regards

The formula should be able to exclude the fact that in each row "-" is duplicate and should not include cell of column B, D and F (it should not use a range) in the formula.
 
Upvote 0
Doesn't Marcelo's post 6 formula meet the requirement?

Can any of your rows have 3 numbers in the relevant columns?
 
Last edited:
Upvote 0
Doesn't Marcelo's post 6 formula meet the requirement?

Can any of your rows have 3 numbers in the relevant columns?




I didn't notice post #6 sorry. Yes it did solved my problem.

Yes it can have 3 or more or less than that and it doesn't have to be numbers, would you explain why did you ask ?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,872
Messages
6,181,500
Members
453,047
Latest member
charlie_odd

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