Starting with
Let's work with the core of that formula:
I used this variation of the INDEX(rng,rowref) function.
It starts with a vertical range of cells and returns a reference to the cell in the rowref position.
Example:
=INDEX(A2:A10,3) refers to cell A4 (the 3rd cell in A2:A10)
The MATCH function section, above, finds the first zero in an array of 1's and 0's.
That array is built by this section:
This part: (Sheet1!A$2:A$20<>"")
returns an array of 19 values that ultimately resolve to 1 (for non-blank cells)
and 0 (for blank cells)
The next section: ISNA(MATCH(Sheet1!A$2:A$20,A$2:A2,0))
compares each of the source cells to the cells in the list being built.
If they item is NOT in the list...MATCH returns an error...ISNA!.
The ISNA() function ultimately returns 1's for unlisted items and 0's for listed items.
Non-blank source items score a 1.
If the item is NOT already listed, 1 is subtracted from that value...resulting in 0.
These are the arrays returned by that whole section of the MATCH function
As you can see (hopefully) A3 indicates that the first 2 list items
are non-blank...but are already listed...so the 3rd item is listed.
Now, A4 indicates that the first 3 items are non-blank, and listed
so the 4th items is listed. etc.
Searching for a zero, the MATCH function identifies the first non-blank, unlisted item
and returns its relative position in the list.
That position is used by the INDEX function to return that item from the list.
I hope that gives you enough to work with.
Bookmarks