Compare values in multiple sheets

M

marcu_lucia

Hello

I am very new to VBA.
Maybe someone can help me with some ideas or examples. The problem
is this:
I have 3 sheets :
--- sheet1 contains item ids and prices
--- sheet2 contains item ids and weight
--- in sheet3 i have to add only the rows that have same value in
the ids column, copying the price from the first sheet and weight from
the second, and at the end sum up the prices value and the weights
value

I've searched for examples on how i can compare values in different
sheets, but had no success :(

If there is someone that had this problem please help me.

Thanks a lot,
Lucia
 
G

Guest

In A1 of Sheet3 put in the formula

=if(countif(Sheet2!A:A,Sheet1!A1)>0,A1,na())
then drag fill down the column until you get to the last row that has values
in Sheet1.

select column 1 of sheet1 and do Edit=>copy, then immediately Edit=>Paste
special and select values.
With column 1 still selected do
edit=>Goto=>special and select constants and errors

Do edit =>Delete and select entire row

In Sheet3
now go to B1 and put in
=vlookup(A1,Sheet1!$A$1:$B$50,2,False)

in C1 put in
=Vlookup(A1,Sheet2!$A$1:$B$50,2,false)
select B1:C1 and drag fill down the column.

Select Columns C and B and do edit=>copy, then edit=>Paste Special and
select values.

I assume you can do the rest.
 
M

marcu_lucia

hello again,


thanks for your help. i managed to solve the problem using the
vlookup function.


I'm greatful for your help and please excuse the long time until i
replied.


Lucia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top