Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have two spreadsheets. The first one has a column with numbers in it.
The second one has a column with the same numbers and a description column as well. Each number can have more than one description. What I want to do do is iterate the rows in Sheet 1 and lookup the numbers in sheet 2. Then return all the descriptions to sheet 1 and put them in the cell next to the number. If there are multiple descriptions for a number we would like them separated by a comma. Is there a function for something like this? TIA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use the macro below.
Sub test() With Sheets("Sheet1") Sh1RowCount = 1 Do While .Range("A" & Sh1RowCount) < "" data = .Range("A" & Sh1RowCount) With Sheets("Sheet2") Sh2RowCount = 1 Description = "" Do While .Range("A" & Sh2RowCount) < "" If .Range("A" & Sh2RowCount) = data Then If Description = "" Then Description = .Range("A" & Sh2RowCount) Else Description = Description & ", " & .Range("A" & Sh2RowCount) End If End If Sh2RowCount = Sh2RowCount + 1 Loop End With .Range("B" & Sh1RowCount) = Description Sh1RowCount = Sh1RowCount + 1 Loop End With End Sub "gh" wrote: I have two spreadsheets. The first one has a column with numbers in it. The second one has a column with the same numbers and a description column as well. Each number can have more than one description. What I want to do do is iterate the rows in Sheet 1 and lookup the numbers in sheet 2. Then return all the descriptions to sheet 1 and put them in the cell next to the number. If there are multiple descriptions for a number we would like them separated by a comma. Is there a function for something like this? TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Iterate rows, add like values - an easier way? | Excel Programming | |||
Extracting rows from a spreadsheet using values from another shee | Excel Discussion (Misc queries) | |||
Can't iterate thru a row with For | Excel Programming | |||
Iterate through the values in a named range? | Excel Programming | |||
Iterate columns | Excel Programming |