View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Searching data in 3 different field

If the data were small, I think I'd just loop through the rows looking for a
match in all three columns.

If the data were large, I think I'd use .Find() to look for a match in one
column and then check the other two columns.

If I were trying to bring back a field based on all 3 matches, I would use a
formula instead.

dim myCell as range
dim myRng as range
with worksheets("tablesheetnamehere")
set myrng = .range("A1",.cells(.rows.count,"A").end(xlup))
end with

for each mycell in myrng.cells
if lcase(mycell.value) = lcase(valuetocheckcolumnA) then
if lcase(mycell.offset(0,1).value) = lcase(valuetocheckcolumnB) then
if lcase(mycell.offset(0,2).value) = lcase(valuetocheckcolumnC) then
'found a match--what happens next
end if
end if
end if
next mycell

bmurlidhar wrote:

Dear friends

I want to write a macro which search in 3 column and match searching
criteria

A B C
1 Pravin Kumar Jain

My data is stored in above format and i want search want to search
"Pravin Kumar Jain" and it should match. Please help me to which
function I should use.

Thank you in advance

from
Murlidhar


--

Dave Peterson