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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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:

ABCDEFG
1Data1Y/NData2Y/NData3Y/NDuplicate/Safe
2121Y-Y-N
3-Y133N133N
4-N-Y-N
5-Y565N-Y
6-Y-N336Y
7778Y778Y-N

<colgroup><col span="7"><col></colgroup><tbody>
</tbody>

<colgroup><col span="7"><col></colgroup><tbody>
</tbody>

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:

ABCDEFG
1Data1Y/NData2Y/NData3Y/NDuplicate/Safe
2121Y-Y-N
3-Y133N133N
4-N-Y-N
5-Y565N-Y
6-Y-N336Y
7778Y778Y-N

<tbody>
</tbody>

<tbody>
</tbody>

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,214,887
Messages
6,122,095
Members
449,064
Latest member
Danger_SF

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