Compare All cells in Range 1 to All cells in Range 2 – Give result

MaxTrax

Board Regular
Joined
Nov 18, 2014
Messages
91
Hi Guys,

I need two (2) formulas for the following please:

Compare ALL of the values in 1 range to ALL the values in the other range and give result if ANY cells match or don’t match.
(more than 1 cell may match and that’s ok)

I don’t want to compare just 1 cell (eg B1) in range B1:B200 to any cell in range A1:A500

The values will be Integers for one formula and text for the other.
Something like this:
If(Match(Any cell in B1:B200(or defined name) to Any cell in A1:A500), then give “Match” if matched otherwise give “No Match” if not matched.

These formulas will also be used with a *defined name* instead of a range sometimes. I assume ‘Name’ will just replace ‘Range’ in formulas.

They will be used separately throughout the workbook to compare *different* ranges.

Thanks

MaxTrax
 
If the side by side cell value have to match like A2=B2, A3=B3, A4=B4, etc. then, this is what you need:


Excel 2016
ABC
1Values of AValues of B
2416416
3519519
4403403
5DataData
6392392
7495495
8DataData
9335335
10446446
11329329
12543543
13396396
14489489
15187187
16499499
17545545
18596596
19460460
20319319
21350350
22125125
23459459
24575575
25313313
26481481
27492492
28519519
29500500
30SoloSoloAll Match
31
Sheet1
Cell Formulas
RangeFormula
C30=IF(SUMPRODUCT(--($A$2:$A$30=$B$2:$B$30))=ROWS($A$2:$A$30),"All Match","")


Otherwise if the matched value can be anywhere in the other column, then:



Excel 2016
ABC
1Values of AValues of B
2416416
3519519
4403403
5DataData
6392392
7495495
8DataData
9335335
10446446
11329329
12543543
13396396
14489489
15187187
16499499
17545545
18596596
19460460
20319319
21350350
22350460
23459459
24575575
25313313
26481481
27492492
28519519
29500500
30SoloSoloAll Match
31
Sheet1
Cell Formulas
RangeFormula
C30=IF(SUMPRODUCT(--ISNUMBER(MATCH($A$2:$A$30,$B$2:$B$30,0)))=ROWS($A$2:$A$30),"All Match","")
 
Last edited:
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
It will still work.

Example:



Excel 2016
ABC
1Values of AValues of B
2416416
3519519
4403403
5DataData
6392392
7495495
8DataData
9335335
10446446
11329329
12543543
13396396
14489489
15187187
16499499
17545545
18596596
19460460
20319319
21350350
22350460
23459459
24575575
25313313
26481481
27492492
28519519
29500500
30SoloSoloAll Match
31492
32492
33519
34500
35Solo
Sheet1
Cell Formulas
RangeFormula
C30=IF(SUMPRODUCT(--ISNUMBER(MATCH($A$2:$A$35,$B$2:$B$30,0)))=ROWS($A$2:$A$35),"All Match","")
 
Upvote 0
What am I missing?...Can't get this to work.

ABC
1110
227
3316
448
5522
6619
777
883
9910
1010
1111
1212
1313
1414
159999 <<<<
1616
1717
1818
1919
2020
2121
2222
2323All Match

<tbody>
</tbody>

Code:
[TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"]IF(SUMPRODUCT(--ISNUMBER(MATCH(B1:B9,A1:A23,0)))=ROWS(B1:B9),"All  Match","-")[/TD]
[/TR]
</tbody>[/TABLE]

Result at C23 ( Note A15)
 
Upvote 0
Always the lookup value of match and the reference in the row will be the column in which most no. of values are there.


Excel 2016
ABC
1110
227
3316
448
5522
6619
777
883
9910
1010
1111
1212
1313
1414
159999<<<<
1616
1717
1818
1919
2020
2121
2222
2323-
24
Sheet5
Cell Formulas
RangeFormula
C23=IF(SUMPRODUCT(--ISNUMBER(MATCH(A1:A23,B1:B9,0)))=ROWS(A1:A23),"All Match","-")
 
Last edited:
Upvote 0
Still missing something...........

ABCD
11020
22050
33060
44030
550120
660140
770120
88020
990
10100
11110
12120
13130
14140
15150
16160
17170
18180
19190
20200
21210
22220
23230-

<tbody>
</tbody>

Code:
=IF(SUMPRODUCT(--ISNUMBER(MATCH(A1:A23,B1:B8,0)))=ROWS(A1:A23),"All Match","-")

I would think result should be "All Match" at C23

Thanks
 
Upvote 0
This works....I think :(

ABC
11020
22050
33060
44030
550120
660140
770120
88020
990
10100
11110
12120
13130
14140
15150
16160
17170
18180
19190
20200
21210
22220
23230All Match

<tbody>
</tbody>

Code:
{IF(SUM(--(B1:B8=TRANSPOSE(A1:A23)))=COUNTA(B1:B8),"All Match","-")}
as array at C23

and

ABC
11020
22050
33060
4405555 <<<<<
550120
660140
770120
88020
990
10100
11110
12120
13130
14140
15150
16160
17170
18180
19190
20200
21210
22220
23230-

<tbody>
</tbody>

No match at C23 "-"


Thanks

MaxTrax
 
Upvote 0
For your first question, I think you could also use this standard-entry formula, though it does require Excel 2010 or later.
2 examples shown.

Excel Workbook
ABC
1Values of AValues of B
2384416
368519
4264403
5139Data
6453392
7190495
8295Data
9Data335
10176446Match
11
12
13Values of AValues of B
14384416
1568519
16264403
17139Data
18453392
19190495
20295Data
21Item335
22176446No Match
Match 1




Your second question is unclear to me. You stated:
Match ALL cells in A2:A30 to ALL cells in B2:B30 (or a defined 'Name') and give result "All Match" or "" in C30

In other words *every* cell must match.
Both sets of data in posts #15 and #18 contain cells in column A that do not match anything in column B, yet you seem to be saying that one result should be "All natch" (#18) and one result should be "No Match" (#15).

If you gave smaller samples (say max of 10 rows) and the expected result with clear explanation of why that result, you would probably get your problem solved more quickly.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

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