View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Match (Fucntion, Script, or Macro)

I am trying to find a script and/or macro that can
compare data of two columns in three different
worksheets:
A, B, and C. Also put corresponding data of Column A from
worksheet A to the column A of Worksheet B. Mentioned
below is a sample:

Worksheet A:
Column A Column B Column C
1 Apple Small
2 Orange Small
3 Orange Large
4 Mango Small
5 Pear Medium
6 Orange 2 inch
7 Orange 5 ounce

Worksheet B:
Column A Column B Column C
Apple Small
Mango Small
Orange Small
Mango Small
Apple Small
Orange Sizes
Orange Measurements
Apple Small
Kiwi Small
Pear Small

Worksheet C:
Column A Column B
Sizes 2 inch
weight 5 ounce

I want to compare values of column B of Worksheet A with
the Column B of Worksheet B. (Please note that there is
Many-to-many relationships between Worksheets A to B)
Where there is a match, I want to put a corresponding
value from the column A of Worksheet A into the column A
of worksheet B. However, since the relationship is many-
to-many, I have to compare the values in the column C
from Wkst A to Column C in the Wkst B for
differentiation. In some cases, nstead of value, the
alias is mentioned in the Column C of wkst B. For such
cases, I have to match the value of Column C from wkst A
to the Column B of the Wkst c. So after the comparison,
the worksheet B should look like this.

Worksheet B
Column A Column B Column C
1 Apple Small
4 Mango Small
2 Orange Small
4 Mango Small
1 Apple Small
6 Orange Sizes
7 Orange Weight
1 Apple Small
Kiwi Small
5 Pear Small