comparing two sheets base on unique value

reachmanoj27

New Member
Joined
Aug 31, 2016
Messages
6
[FONT=Arial, Helvetica Neue, Helvetica, sans-serif]I have 2 sheets named orange book data alerts and total orange book data alerts , both sheets have data from A to M, unique value is in Column A in both the sheets. here I compare [/FONT]orange book data alerts[FONT=Arial, Helvetica Neue, Helvetica, sans-serif] with [/FONT]total orange book data alerts.[FONT=Arial, Helvetica Neue, Helvetica, sans-serif] When there is a match, compare its row cell values for each and every column and if there is difference the code should be written as Update in sheet orange book column N and if the unique value is not available it should write New addition in column N.. Below is code which i tried. it is working for if there is any update in data for one column, i need help so that i can compare all the columns and write as new addition if unique value is not present.

[/FONT]Sub compare10()
Dim w1 As Worksheet, w2 As Worksheet
Dim c As Range, a As Range


Set w1 = Sheets("total orange book data")
Set w2 = Sheets("orange book data alerts")
With w1
For Each c In .Range("a2", .Range("a" & Rows.Count).End(xlUp))
Set a = w2.Columns(1).Find(c.Value, lookat:=xlWhole)
If Not a is nothing then
if.cells(c.row,10).value<>w2.cells(a.row(a.row,10) then

w2.Cells(a.Row, 14).Value = "update"
End If
Next c
End With


End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hello,

You should be able to implement this with a nested formula. Paste the following into cell N2 in the worksheet "orange book data alerts" and copy down:

=IF(NOT(ISERROR(VLOOKUP(A2,'total orange book data'!A:A,1,0))),IF(VLOOKUP(A2,'total orange book data'!A:B,2,0)<>B2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:C,3,0)<>C2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:D,4,0)<>D2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:E,5,0)<>E2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:F,6,0)<>F2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:G,7,0)<>G2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:H,8,0)<>H2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:I,9,0)<>I2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:J,10,0)<>J2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:K,11,0)<>K2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:L,12,0)<>L2,"Update",IF(VLOOKUP(A2,'total orange book data'!A:M,13,0)<>M2,"Update","")))))))))))),"New Addition")

Apologies if there are any errors in the formula.

Do let me know if it doesn't work.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,684
Members
449,116
Latest member
HypnoFant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top