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
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
This will work for both text and number:


Excel 2016
ABCD
1384416Values in B that are in A
268519Data
3264403489
4139Data187
5453392Solo
6190495
7295496
8Data335
9176446
10440329
11452543
12284396
13485489
14197187
1531499
16Solo545
17169596
18187460
19473319
20253462
21408362
22255459
23489575
24317313
2520481
2618492
27310519
28272500
29412Solo
Sheet1
Cell Formulas
RangeFormula
D2{=IFERROR(INDEX($B$1:$B$29,SMALL(IF(ISNA(MATCH($B$1:$B$29,$A$1:$A$29,0)),999999,ROW($B$1:$B$29)-ROW($B$1)+1),ROWS(D$2:D2))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.


Adjust the range according to your nees.
 
Last edited:
Upvote 0
An example below:


ABCD
1323111
2112359
31085
469123
5237277
618832
744114
896218
915869< Match (69)
10132343
11113341
12302341Duplicate ok(341)
13828
14148170
1524147
161869RESULT HERE

<tbody>
</tbody>


Compare ALL of B1:B16 to ALL of A1:A16. In this case there is a match of 69

Column A1:A16 could be a defined name stored elsewhere.

Thanks

MaxTrax
 
Last edited:
Upvote 0

Excel 2016
ABC
1Values of AValues of B
2384416 
368519
4264403
5139Data
6453392
7190495
8295Data
9Data335
10176446
11440329
12452543
13284396
14485489
15197187
1631499
17Solo545
18169596
19187460
20473319
21253462
22408362
23255459
24489575
25317313
2620481
2718492
28310519
29272500
30412Solo
Sheet1
Cell Formulas
RangeFormula
C2=IF(COUNTIF(B$2:B2,B2)=1,IF(ISNA(MATCH(B2,$A$2:$A$30,0)),"","),"")
 
Last edited:
Upvote 0
Thanks Nishant94...........But I just need a result that says "Match" or "No Match" in C16 (My example)

I don't need to see the actual values displayed. BTW Can you copy array formulas?

Can you also show the formula using a defined name for one range?

I can also use the formula you have given for another use :)



MaxTrax
 
Last edited:
Upvote 0

Excel 2016
ABC
1Values of AValues of B
2384416
368519
4264403
5139Data
6453392
7190495
8295Data
9Data335
10176446
11440329
12452543
13284396
14485489
15197187
1631499
17Solo545
18169596
19187460
20473319
21253462
22408362
23255459
24489575
25317313
2620481
2718492
28310519
29272500
30412SoloMatch
Sheet1
Cell Formulas
RangeFormula
C30{=IF(SUMPRODUCT(--($A$2:$A$30=TRANSPOSE($B$2:$B$30))),"Match","No Match")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
Thank you Nishant94 but see below….

Can I use this with a ‘Defined Name’ range. The particular ‘Name’ I wish to compare to has only 25 cells. I may wish to compare a range of say 800 cells to it. How can this be achieved please?

I have tried to substitute ‘Name’ for A2:A30 in your formula but I'm not getting a true result (some 'match' some 'no match' after recalculate).

Thanks

MaxTrax
 
Last edited:
Upvote 0
Can you please also provide a formula for this:

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.

Thanks

MaxTrax
 
Last edited:
Upvote 0

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
21462462
22362362
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","")
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,934
Members
449,094
Latest member
teemeren

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