ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compare values in multiple sheets (https://www.excelbanter.com/excel-programming/359119-compare-values-multiple-sheets.html)

marcu_lucia

Compare values in multiple sheets
 

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


--
marcu_lucia
------------------------------------------------------------------------
marcu_lucia's Profile: http://www.excelforum.com/member.php...o&userid=33592
View this thread: http://www.excelforum.com/showthread...hreadid=533712


Tom Ogilvy

Compare values in multiple sheets
 
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.

--
Regards,
Tom Ogilvy


"marcu_lucia" wrote:


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


--
marcu_lucia
------------------------------------------------------------------------
marcu_lucia's Profile: http://www.excelforum.com/member.php...o&userid=33592
View this thread: http://www.excelforum.com/showthread...hreadid=533712



marcu_lucia[_2_]

Compare values in multiple sheets
 

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


--
marcu_lucia
------------------------------------------------------------------------
marcu_lucia's Profile: http://www.excelforum.com/member.php...o&userid=33592
View this thread: http://www.excelforum.com/showthread...hreadid=533712



All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com