If I am following this correctly this is a slightly modified VLOOKUP. It has an error handler, but as MarvinP stated the IFERROR function in the newer versions is much simpler to apply and easier to edit / debug.
I left your original Invoice Sheet table in place and moved mine down to row 11.
Here is a 2003 compatible formula:that includes qualifying the duplicate "P"s with a nested COUNTIF. The COLUMNS($A:A) device allows for the one formula to be filled down and across without having to hard code the columns argument.
The formula for newer versions of Excel would look like this:which is much shorter.
File is attached.
Does this do what you want?
Bookmarks