OK, so you need help with a spreadsheet, and what type of work do you do? What you are asking is more of a coding problem, and not an invoice or credit problem. Now, with that, we do not offer turn key solutions for problems, but we help when stuck.
Besides, do the two lines need to match, or does the code have to figure out that 80 is in index 3 of the list, and in the master index it is number 9? See what I am asking? We can author wrong code for you all day, and do not wish to do this. Your scope of the "program" is lacking logic to fulfill the requirements stated within the problem.
What is to happen when we have two 80 invoices are found? Just wash it, or do we qualify the selection and drill down to another range of qualifiers?
I am certain that someone will come along and help out, we just need to make certain that we understand the scope clearly.
I have said it once, I will say it again. IT!