Array formula to get unique values from two sheets

neodjandre

Well-known Member
Joined
Nov 29, 2006
Messages
950
Office Version
  1. 2019
Platform
  1. Windows
I have two sheets where in column A there are references in the format:

REF02392
REF03381
REF09345P
REF02465O
REF08573P
REF03472P

Some of the references are duplicate in both sheets and some only exist in one of the sheets.

I am looking for an array formula that will extract only the unique reference values from both sheets in a combined list in a new 3rd sheet.

Is this possible?

many thanks in advance,
Andrew
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
This is a named range & formula solution to what I think you require.

Create named ranges for your 2 columns:

List_1
=OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet1!$A:$A),1)
List_2
=OFFSET(Sheet2!$A$2,0,0,COUNTA(Sheet2!$A:$A),1)

On your 3rd sheet use the following formula:

=SORT(UNIQUE(FILTER(IFERROR(INDEX(List_1,SEQUENCE(ROWS(List_1)+ROWS(List_2))),INDEX(List_2,SEQUENCE(ROWS(List_1)+ROWS(List_2))-ROWS(List_1))),IFERROR(INDEX(List_1,SEQUENCE(ROWS(List_1)+ROWS(List_2))),INDEX(List_2,SEQUENCE(ROWS(List_1)+ROWS(List_2))-ROWS(List_1)))<>0)))

This is dynamic so the list will increase automatically, one of the guru's maybe able to give you a more concise solution or a vba solution.
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Hi,

Create name range (see *JW00 answer) then use this formula:

=IFERROR(IFERROR(INDEX(list_1, MATCH(0, COUNTIF($A$1:A1,list_1), 0)), INDEX(list_2, MATCH(0, COUNTIF($A$1:A1, list_2), 0))),"")
it's an array formula
 
Upvote 0
hello updated platform and office - thanks.. I will test the answers and report back
 
Upvote 0
ok this works as expected using Tom.Jones answer. It seems that I have to add a 3rd sheet now (list_3) - can't get my head around the addition to the array formula. Would you mind helping me with this please? many thanks for the prompt and great answer.
 
Upvote 0
Try it like
Excel Formula:
=IFERROR(IFERROR(INDEX(list_1, MATCH(0, COUNTIF($A$1:A1,list_1), 0)), IFERROR(INDEX(list_2, MATCH(0, COUNTIF($A$1:A1, list_2), 0)),INDEX(list_3, MATCH(0, COUNTIF($A$1:A1, list_3), 0)))),"")
 
Upvote 0
hello updated platform and office
Thanks for that. (y)

With 2019, if you wanted to try without the named ranges and you will have less than, say (I'm guessing a bit here) about 1,500 references like the samples in total then you could try this.
As written I have allowed for up to 500 rows of data on each sheet.
One other slight difference with this method is that if there may be any blank cells among the data it should handle that, whereas the named ranges using COUNTA may result in some references missing from the final list.

Cell Formulas
RangeFormula
A2:A15A2=IFNA(INDEX(FILTERXML("<p><c>"&TEXTJOIN("</c><c>",1,Sheet1!A$1:A$500,Sheet2!A$1:A$500,Sheet3!A$1:A$500)&"</c></p>","//c"),MATCH(0,COUNTIF(A$1:A1,FILTERXML("<p><c>"&TEXTJOIN("</c><c>",1,Sheet1!A$1:A$500,Sheet2!A$1:A$500,Sheet3!A$1:A$500)&"</c></p>","//c")),0)),"")
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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