Formula?

S

Snoopy

I need a way to associate data in one column with data in another column so
that when data is typed in say cell A2, data that is associated with it
appears in say cell
B2. I need this to happen all the way down the columns in succesive rows.
Regards,
 
M

Mark

Hi,
I would use a macro to do this.
This macro loads the criterial column data into two arrays.
To try it out:
put data into D6 (item to be associated) and down
and data into A25 (list of names) and A26 (associated
references to A25 column) and down...
There is no error-checking so if data does not exist or if
only one entry is in any one cell then an error may occur.

I wrote this for someone else so you might be able to
modify to suit.
If not send me the data.
-Mark
(e-mail address removed)
http://www.geocities.com/excelmarksway



Dim Abb(0 To 50), Goo(0 To 50)


Public Sub Boris()
Dim i As Integer
Dim cell
Dim arco
Dim strA, strB As String
i = 0
Range("A25").Select
Set a = Selection
Range(a, a.End(xlDown)).Select
For Each cell In Selection
Abb(i) = cell.Value
i = i + 1
Next
a.Offset(0, 1).Select
Set a = Selection
i = 0
Range(a, a.End(xlDown)).Select
For Each cell In Selection
Goo(i) = cell.Value
i = i + 1
Next
Range("D6").Select
strA = ""
strB = ""
Set a = Range("D6")

Do Until a.Value = ""
a.Select
strA = a.Value
For x = 0 To 50
strB = Abb(x)
If strB = "" Then
Exit For
End If
If strA = strB Then
a.Offset(0, 1).Value = Goo(x)
Exit For
End If
Next x
Set a = a.Offset(1, 0)
x = 0
strA = ""
strB = ""
Loop
End Sub

Public Sub ClearResults()
Dim i As Integer
i = 0
Range("E6").Select
Set c = Selection
Do Until c.Offset(i, -1).Value = ""
c.Offset(i, 0).Value = ""
i = i + 1
Loop

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top