Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find if all of a key's values match in Excel?

I am trying to find out if there is way to write an excel formula that can see if all values from a certain key match each other. I am hoping to do this within one formula in one cell so that it can easily be dragged down for the entire column.

I've looked into different formulas, but I'm finding it difficult as there could a variable amount of lines per key.

An expected result would look like this:

Key Value Do all values match for key?
1 1 Yes
2 1 No
2 2 No
3 3 Yes
3 3 Yes
3 3 Yes
like image 576
Michael Dahle Avatar asked Sep 06 '25 08:09

Michael Dahle


2 Answers

This would work in Office 365 as well: =IF(ABS(MMULT((TOROW(A2:A7)=A2:A7)*(TOROW(B2:B7)<>A2:A7),ROW(A2:A7)^0)),"No","Yes")

Or more dynamic:

=LET(range, A2:B7,
     a,     TAKE(range,,1),
     b,     DROP(range,,1),
IF(ABS(MMULT((TOROW(a)=a)*(TOROW(b)<>a),SEQUENCE(ROWS(a),,,0))),
   "No",
   "Yes"))
like image 154
P.b Avatar answered Sep 09 '25 19:09

P.b


(likely a duplicate but having a hard time finding a dupe target)

Using IF and COUNTIFS:

=IF(COUNTIFS(A:A,A2,B:B,"<>"&B2)>0,"No","Yes")

enter image description here

like image 36
BigBen Avatar answered Sep 09 '25 18:09

BigBen