Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default comparing worksheets

Hi,
I have 1 workbook which consists of 4 worksheets. The data in these
worksheets are names of people. Does anybody has a macro (or some ways)
to compare these 4 worksheets and highlight those names that exists in
all 4 worksheets ?
thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default comparing worksheets

you could go to the first worksheet and next to the list of people you could
enter a formula like

ex: Cell B2
=if(sum(--(countif(Sheet2!A:A,A2)0),--(countif(Sheet3!A:A,A2)0),--(Countif
(sheet4!A:A,A2)0))=3,"All 4","No")

then drag fill this down the column. This assumes testing in Column A, but
you could choose more columns if need be.

--
Regards,
Tom Ogilvy

"Lynn" wrote in message
oups.com...
Hi,
I have 1 workbook which consists of 4 worksheets. The data in these
worksheets are names of people. Does anybody has a macro (or some ways)
to compare these 4 worksheets and highlight those names that exists in
all 4 worksheets ?
thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default comparing worksheets

can i create a button for this formula so that i do not have to
remmember it and type it out everytime when i need to use it?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default comparing worksheets

Sub AddFormula()
With Worksheets("Sheet1")
set rng = .range(.Cells(2,1),.Cells(rows.count,1).end(xlup))
End With
rng.offset(0,1).Formula = "=if(sum(--(countif(Sheet2!A:A,A2)0)," & _
"--(countif(Sheet3!A:A,A2)0),--(Countif(sheet4!A:A,A2)0))" & _
"=3,""All 4"",""No"")"
End Sub

--
Regards,
Tom Ogilvy


"Lynn" wrote in message
ups.com...
can i create a button for this formula so that i do not have to
remmember it and type it out everytime when i need to use it?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default comparing worksheets

Tom,
how to use this AddFormula ?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default comparing worksheets

Here are some resouces for learning about programming in VBA.
http://www.mvps.org/dmcritchie/excel/getstarted.htm

http://web.archive.org/web/200312040...01/default.asp


http://support.microsoft.com/support...01/default.asp
Microsoft Excel for Windows -- Visual Basic for Applications 101


http://www.mvps.org/dmcritchie/excel....htm#tutorials

--
Regards,
Tom Ogilvy


"Lynn" wrote in message
oups.com...
Tom,
how to use this AddFormula ?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default comparing worksheets

How would the code for this be changed if comparing 2 excel documents? I need
to compare two spreadsheets and delete rows on a large list based on tentries
occurence on another list.

"Tom Ogilvy" wrote:

Sub AddFormula()
With Worksheets("Sheet1")
set rng = .range(.Cells(2,1),.Cells(rows.count,1).end(xlup))
End With
rng.offset(0,1).Formula = "=if(sum(--(countif(Sheet2!A:A,A2)0)," & _
"--(countif(Sheet3!A:A,A2)0),--(Countif(sheet4!A:A,A2)0))" & _
"=3,""All 4"",""No"")"
End Sub

--
Regards,
Tom Ogilvy


"Lynn" wrote in message
ups.com...
can i create a button for this formula so that i do not have to
remmember it and type it out everytime when i need to use it?




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
Comparing on 2 worksheets Roman Excel Worksheet Functions 5 October 24th 08 07:42 PM
Comparing 2 worksheets Ben Watts[_2_] Excel Worksheet Functions 0 September 26th 07 06:02 PM
Comparing two worksheets Sasikiran Excel Discussion (Misc queries) 2 September 26th 07 04:46 PM
Comparing two Worksheets double__T Excel Worksheet Functions 2 February 17th 06 06:37 AM
Comparing two worksheets Dennis Excel Programming 1 November 14th 03 08:08 PM


All times are GMT +1. The time now is 01:02 AM.

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"