0

I have a dataset such as below in Excel:

Tel Mob Off Checking
45345 9473 5356 Match
675673 35232 786547 No match
54657 1353 42545 No match
534734 534734 546 No match
24566 5456 4525 No match
45345 1343 26436 Match

Then, I would like to check whether the Tel column has matched with any of the Tel, Mob and Off column. However, if the match is in the same row, then it's still considered unmatched. The Checking column is the exactly output that I want.

I have try using this simple formula, however, it's still didn't get the output as I wanted.

IF((COUNTIF($A$2:$A$7,A2) + COUNTIF($B$2:$B$7,A2) + COUNTIF($C$2:$C$7,A2))<2,"No match","Match")

Is there any other formula in Excel that could cater this other than using Kutools or VBA?

3
  • Why has the last row "No match"? It's the pendant to the first row ... Commented Oct 3, 2022 at 13:38
  • @Ike yup should be match as well. has been corrected Commented Oct 3, 2022 at 13:44
  • What if the match is on the same row for a given value of Tel col, but also in other column on a different row? How would be that situation handled? For example the following 2x3 array {1,0,1};{0,2,1}. On the first row 1 has a match on the same row (no Match), but on the second row there a match to 1 a valid one. So the result would be uncertain. It is not clear this statement to me for all possible scenarios: "if the match is in the same row, then it's still considered unmatched" Commented Oct 3, 2022 at 18:28

5 Answers 5

3

Alternatively try MMULT():

=IF(SUM(N(MMULT(N(A$2:C$7=A2),{1;1;1})>0))>1,"","No ")&"Match"
Sign up to request clarification or add additional context in comments.

Comments

2

This one is a bit shorter :-)

=IF(COUNTIF($A$2:$C$7,A2) - COUNTIF(A2:C2,A2) > 0,"Match","No match")

It first counts the all occurences of Tel in the whole matrix and then removes the ones from the same row (e.g. 534734). If the result is > 0 then there are matches.

Comments

2

Lets give a try to an array version in F2 (this is an extension of @Ike's answer)

=LET(cntRange, COUNTIF(A2:C7,A2:A7), 
  cntRow,BYROW(--(A2:C7=A2:A7), LAMBDA(row, SUM(row))),
  IF((cntRange - cntRow) > 0, "Match", "No Match"))

or without LET:

=IF((COUNTIF(A2:C7,A2:A7) - 
  BYROW(--(A2:C7=A2:A7),LAMBDA(row, SUM(row)))) > 0, "Match", "Not Match")

sample excel file

The trick here is to emulate COUNTIF with --(A2:C7=A2:A7) it returns a 6x3 matrix and per row as many 1s as repetition we have of each cell of A2:A7, then SUM(row) does the magic of the count.

3 Comments

First I thought this is cool - but it is not the correct solution: if you put e.g. 675673 in B4, row 3 should give a match ...
Thanks, @Ike, you were correct. I updated my answer. Now it works for the failed case. For the array version, I ended up in a variant of your solution. I gave you credit. To build the recurrence per row for calculating the count, I had to emulate it via SUM of 1s.
As always: there are several solutions :-)
2

You may try this as well.

enter image description here

• Formula used in cell D2

=IF(SUM(N(A$2:C$7=A2))>SUM(N(A2:C2=A2)),"Match","No Match")

Comments

0

I got this formula, Not sure if there is any direct way though;

=IF(COUNTIFS(A2:C2,A2)>1,"No Match",IF(OR(COUNTIFS($A$2:$A$7,A2)>1,COUNTIFS($B$2:$B$7,A2)>0,COUNTIFS($C$2:$C$7,A2)>0),"Match","No Match"))

Hope this Helps...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.