I am trying to extract the "remainder" (the non-matching portion) of a search using Excel 2003. I tried using various combinations of functions but it seems that there's no specific function that can return the non-matched portion of a record found through a match with another part of the record.
Here an illustration of what I am trying to do. I have two lists. List A has 2000 records. Each record is an array of 9 cells, each containing a single digit in columns A through I. The digits are always in ascending order. So that data looks like this:
[A] [B] [C] [D] [E] [F] [G] [H] [I]
1 2 2 3 4 5 7 7 9
2 4 5 5 6 6 8 9 9
. . . etc.
List B has 30 records. These are the values that are searched for in the List A records. Each record is an array of 5 cells, each containing a single digit in columns L through P. These digits are always in ascending order. So this data looks like this:
[L] [M] [N] [O] [P]
1 1 3 4 5
2 3 5 7 9
1 2 3 4 5
. . . etc.
Each record in List B is searched for in List A. It is a match if all five digits in the List B record match five of the digits in the List A record. So in this example, the first List B record does not match anything in List A. The second and third List B records both match the first List A record, and no List B records match the second List A record.
When there is a match, the "remainder" is the other four digits of the List A record that were not part of the match. For the two matches in this example, this would be illustrated like this:
List A record: 1 2 2 3 4 5 7 7 9
List B record: 2 3 5 7 9
Remainder: 1 2 4 7
List A record: 1 2 2 3 4 5 7 7 9
List B record: 1 2 3 4 5
Remainder: 2 7 7 9
So the result for the first List A record is: 1247 2779
and the result for the second List A record is a blank.
The values in the List B records can change so the solution needs to be "generic" so the results can be updated without changing formulas.
I tried basing a solution on the COUNT
function to count the frequency of each digit 0-9 in every item on List A and then use IF
and AND
functions (specifying which and how many of each digit is required to qualify as a match), to tell me which items on List B match List A. My attempts to use other functions have failed to extract the remainder in the manner that I want it to.
This question is similar to How to extract reminder of a match in MS Excel 2003, but the number patterns are different. A solution was found for that question, but it is difficult to figure out how to modify the answer to fit this problem. From time to time, I have similar problems of this nature, so I'm hoping for an answer that includes a process I can follow to develop similar solutions for other similar problems.