ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Match ! (https://www.excelbanter.com/excel-worksheet-functions/223318-match.html)

[email protected]

Match !
 
Hi All,

I have workbook with 2 sheets, sheet1 & sheet2.
sheet1 data as follows:
Group Id Code Status
125 ABC_DE completed
127 ACD_EF completed
130 ERD478 completed
131 EREDS completed


sheet2
Codes Status
ABC_D
ACD
ERD478
EREDS


By observation u can say only ERD478 & EREDS is exactly matching so i
want the status of that particular code.


Result 1 : Assume sheet1 has ABC as code, in sheet2 I have ABCDEF -
here in this case only part matching
here also i want the status.


Result 2 : If i want to match both Group Id and Code ( assumed sheet2
has Group Id).


Result 3 : If i want to match Codes ( sheet2 ) with Group Id & Codes
of sheet1. ( assumed some codes are appeared in Group Id)


All the above results,I want in VBA.


Thanks in advance.



joel

Match !
 
Hrre is a small example

FindID = 125
Findcode = "ABD_EF"

with sheets("Sheet1")
set c = .Columns("A").Find(what:=FindID, _
lookin:=xlvalues,lookat:=xlWhole)
if not c is nothing then
firstAddr = c.address
do
if c.offset(0,1) = Findcode then
'enter your code here
end if
set c = .Columns("A").Find(after:=c)
Loop While Not c is nothing and c.address < firstaddr
End with


end with


" wrote:

Hi All,

I have workbook with 2 sheets, sheet1 & sheet2.
sheet1 data as follows:
Group Id Code Status
125 ABC_DE completed
127 ACD_EF completed
130 ERD478 completed
131 EREDS completed


sheet2
Codes Status
ABC_D
ACD
ERD478
EREDS


By observation u can say only ERD478 & EREDS is exactly matching so i
want the status of that particular code.


Result 1 : Assume sheet1 has ABC as code, in sheet2 I have ABCDEF -
here in this case only part matching
here also i want the status.


Result 2 : If i want to match both Group Id and Code ( assumed sheet2
has Group Id).


Result 3 : If i want to match Codes ( sheet2 ) with Group Id & Codes
of sheet1. ( assumed some codes are appeared in Group Id)


All the above results,I want in VBA.


Thanks in advance.





All times are GMT +1. The time now is 02:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com