Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do I compare two excel sheets?

I have an excel sheet that is updated every day. I would like compare the two
sheets and give me cells that have changed with exact values:

Eg:

Clothes in stock - 56
Clothes displayed - 30
Clothes sold - 34

Next day
Clothes in stock - 50
Clothes displayed - 31
Clothes sold - 39

Its much more complicated that this but that is the basic jist.

thanks,

Raoul
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default How do I compare two excel sheets?

Here's a quick and dirty routine you can adapt for your purposes. It will
compare "Book1.xls" and "Book2.xls" and list the differences in a new
workbook.

Sub SimpleCompare()
Dim WB1 As Workbook
Dim WB2 As Workbook
Dim ResultWB As Workbook
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Dim Rng1 As Range
Dim Rng2
Dim DestRng As Range

Set WB1 = Workbooks("Book1.xls") '<<< CHANGE
Set WB2 = Workbooks("Book2.xls") '<<< CHANGE
Set ResultWB = Workbooks.Add()
Set DestRng = ResultWB.Worksheets(1).Range("A1")

DestRng(1, 1) = "Cell"
DestRng(1, 2) = WB1.Name & "Value"
DestRng(1, 3) = WB2.Name & "Value"
Set DestRng = DestRng(2, 1)
For Each WS1 In WB1.Worksheets
Set WS2 = WB2.Worksheets(WS1.Name)
For Each Rng1 In WS1.UsedRange.Cells
Set Rng2 = WS2.Range(Rng1.Address)
If Rng1 < Rng2 Then
DestRng(1, 1) = Rng1.Address
DestRng(1, 2) = Rng1.Text
DestRng(1, 3) = Rng2.Text
Set DestRng = DestRng(2, 1)
End If
Next Rng1
Next WS1
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)




"Raoul" wrote in message
...
I have an excel sheet that is updated every day. I would like compare the
two
sheets and give me cells that have changed with exact values:

Eg:

Clothes in stock - 56
Clothes displayed - 30
Clothes sold - 34

Next day
Clothes in stock - 50
Clothes displayed - 31
Clothes sold - 39

Its much more complicated that this but that is the basic jist.

thanks,

Raoul



  #3   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default How do I compare two excel sheets?

Check out Jim Cone's fine commercial Add-in called XL Companion. It's
available at

http://www.realezsites.com/bus/primitivesoftware/

Vaya con Dios,
Chuck, CABGx3





"Raoul" wrote:

I have an excel sheet that is updated every day. I would like compare the two
sheets and give me cells that have changed with exact values:

Eg:

Clothes in stock - 56
Clothes displayed - 30
Clothes sold - 34

Next day
Clothes in stock - 50
Clothes displayed - 31
Clothes sold - 39

Its much more complicated that this but that is the basic jist.

thanks,

Raoul

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default How do I compare two excel sheets?

I assume these are in the same cell, different sheet name.. so you can try
maybe:
In cell B2 of sheet 3:
=if(sheet1!B2=sheet2!B2,"",sheet2!B2)
Although this would leave blanks where the cells don't match...

"Raoul" wrote:

I have an excel sheet that is updated every day. I would like compare the two
sheets and give me cells that have changed with exact values:

Eg:

Clothes in stock - 56
Clothes displayed - 30
Clothes sold - 34

Next day
Clothes in stock - 50
Clothes displayed - 31
Clothes sold - 39

Its much more complicated that this but that is the basic jist.

thanks,

Raoul

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to hide a macros/functions from excel sheets Bepenfriends Excel Discussion (Misc queries) 1 December 5th 06 06:50 PM
Excel 2007 to Excel 2003 (Split data to sheets) BCLivell Excel Discussion (Misc queries) 2 October 27th 06 07:17 PM
Excel Range Value issue (Excel 97 Vs Excel 2003) Keeno Excel Discussion (Misc queries) 2 June 13th 05 02:01 PM
excel should have a function to count sheets carlos sosa Excel Worksheet Functions 7 April 24th 05 08:29 PM
calculating excel spreadsheet files for pensions and life insurance (including age calculation sheets) RICHARD Excel Worksheet Functions 1 March 15th 05 05:49 PM


All times are GMT +1. The time now is 03:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"