I have one array of cells (5x5). There is a number in each cell, and several of them are not unique. I have another array of cells that needs to fill up with values from the first array, but must only take a value if it isn't already in the second array.

For example, in this source array:

1 2 8 5 3
4 9 2 3 1
9 4 3 7 5
6 5 6 0 9

The second array would look like this:

1 2 8 5 3
4 9 7 6 0

Each number would be in a separate cell, and would need to look at the preceding cells to determine which values it can receive, if any.

Any ideas?