Hi,

In the first worksheet I have a set of codes which I need to compare to another worksheet and find matching codes and return the value associated with it in the adjacent column. Normally I would use a vlookup however in this second worksheet I have 4 columns set out as below:

Code | Number | Code | Number

x123 2 z179 3
y567 1 x123 2

I would therefore need to look in both "code" columns to see if I can find the code from the first worksheet and take the number from the "number" column to its right. One additional problem, the code we are looking for could appear in BOTH columns and in which case I would need to sum both values. Therefore from the above example I would get:

x123 = 4
z179 = 3
y567 = 1

Is this possible in either a formula or macro? I would refer the former but please let me know about either.

Many thanks in advance,

GW