Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i have to columns in an Excel worksheet.
Column A has codes(text),one in every cell. Column B has description(text)one in every cell. Codes from column A exist somewhere in column B and some not. How do i match the cells from column A to the cells in column B that under the condition that a cell in column B contains the string from column A Thank u in advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this uses the find command and places the address of the cell in column A in
column C next to the cell in Column B that contains the target. Hopefully you can adapt it to your needs. Sub FindStrings() Dim cell As Range, rng As Range Dim sAddr As String For Each cell In Range("A1:A100") Set rng = Columns(2).Find(What:=cell.Value, _ After:=Range("B65536"), LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False) If Not rng Is Nothing Then sAddr = rng.Address Do rng.Offset(0, 1).Value = rng.Offset(0, 1).Value _ & cell.Address & "," Set rng = Columns(2).FindNext(rng) Loop While rng.Address < sAddr End If Next End Sub -- Regards, Tom Ogilvy "cretesupplies" wrote in message ... i have to columns in an Excel worksheet. Column A has codes(text),one in every cell. Column B has description(text)one in every cell. Codes from column A exist somewhere in column B and some not. How do i match the cells from column A to the cells in column B that under the condition that a cell in column B contains the string from column A Thank u in advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could use a helper column (column C) of cells with formulas like:
=INDEX(B:B,MATCH("*"&A1&"*",B:B,0)) and drag down. If there is no match, you'll see an #n/a error. If you're just looking for the row that has the match: =MATCH("*"&A1&"*",B:B,0) cretesupplies wrote: i have to columns in an Excel worksheet. Column A has codes(text),one in every cell. Column B has description(text)one in every cell. Codes from column A exist somewhere in column B and some not. How do i match the cells from column A to the cells in column B that under the condition that a cell in column B contains the string from column A Thank u in advance -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
search for a string | New Users to Excel | |||
Search for string containing | Excel Discussion (Misc queries) | |||
to search for a string and affect data if it finds the string? | Excel Worksheet Functions | |||
VBA function : How to search a string in another string? | Excel Programming | |||
Search for certain string | Excel Programming |