Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Searching and Matching Lists

Pls help with a macro to solve the task below:

Sheet1, column A has an unfixed or undetermined range of names
starting at "A2".
Sheet2 column A has a related name list also.
For every item in sheet2 column A, search through sheet1 Column A
Where a match is found, indicate "PRESENT" in the corresponding cell
in Sheet2 column B.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Searching and Matching Lists

In Sheet2!B2, enter:
=IF(COUNTIF(Sheet1!A:A,A2)0,"PRESENT","")
then drag down

HTH
--
AP

"sylink" a écrit dans le message de news:
...
Pls help with a macro to solve the task below:

Sheet1, column A has an unfixed or undetermined range of names
starting at "A2".
Sheet2 column A has a related name list also.
For every item in sheet2 column A, search through sheet1 Column A
Where a match is found, indicate "PRESENT" in the corresponding cell
in Sheet2 column B.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Searching and Matching Lists

Sub CompareLists()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng1 as Range, rng2 as Range
Dim cell as Range, res as Variant
set sh1 = Worksheets("sheet1")
set sh2 = Worksheets("sheet2")
set rng1 = sh1.Range(sh1.Cells(2,1),sh1.Cells(2,1).End(xldown ))
set rng2 = sh2.Range(sh2.Cells(2,1),sh2.Cells(2,1).End(xldown ))
for each cell in rng2
res = Application.Match(cell.Value,rng1,0)
if not iserror(res) then
cell.offset(0,1).Value = "Present"
end if
next
end sub

--
Regards,
Tom Ogilvy


"sylink" wrote:

Pls help with a macro to solve the task below:

Sheet1, column A has an unfixed or undetermined range of names
starting at "A2".
Sheet2 column A has a related name list also.
For every item in sheet2 column A, search through sheet1 Column A
Where a match is found, indicate "PRESENT" in the corresponding cell
in Sheet2 column B.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Searching and Matching Lists

Thanks for the prompt response. I'll ur solutions a try

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
Searching Lists smck Excel Discussion (Misc queries) 4 February 2nd 10 10:18 PM
Searching, matching then searching another list based on the match A.S. Excel Discussion (Misc queries) 1 December 13th 06 05:08 AM
Searching and matching in sheet (urgent) [email protected] Excel Worksheet Functions 1 September 10th 06 09:54 PM
Searching for a particlar value and matching to a name.. spezialize Excel Worksheet Functions 8 November 9th 05 01:08 AM
Formula for Searching & matching two values in excel Chris Excel Discussion (Misc queries) 1 January 7th 05 04:34 PM


All times are GMT +1. The time now is 12:53 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"