Index (Maybe)

Chris26

New Member
Joined
Feb 18, 2010
Messages
10
Hi

I have the following data in SHEET1

Column A -- Column B (Incident Dates)
Cluster 1 -- 1/5/2011, 5/5/2011, 9/5/2011
Cluster 2 -- , 5/5/2011, 8/5/2011
Cluster 3 --, 5/5/2011, 8/5/2011, 9/5/2011
----
Cluster 99 --


I would like to return the following results in SHEET2
Column A -- Column B -- Column C -- Column D etc
30/4/2011
1/5/2011 -- Cluster 1
2/5/2011
3/5/2011
4/5/2011
5/5/2011 -- Cluster 1 -- Cluster 2 -- Cluster 3
6/5/2011
7/5/2011
8/5/2011 -- Cluster 2 -- Cluster 3
9/5/2011 -- Cluster 1 -- Cluster 3
10/5/2011
etc

I am using Excel2007

Hope this makes sense.
All help appreciated.
Many Thanks in advance
Chris
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
to do it
remove the first comma in in your date , like here
Excel Workbook
AB
2Cluster 11/5/2011, 5/5/2011, 9/5/2011
3Cluster 25/5/2011, 8/5/2011
4Cluster 35/5/2011, 8/5/2011, 9/5/2011
5Cluster 415/5/2011,20/5/2011,1/5/2011
6Cluster 5
7Cluster 6
8Cluster 7
9Cluster 8
10Cluster 9
11Cluster 10
12Cluster 11
13Cluster 12
14Cluster 13
15Cluster 14
16Cluster 15
17Cluster 16
18Cluster 17
19Cluster 18
20Cluster 19
Sheet1
Excel 2007

then try this code
Code:
Sub Test()
Dim ArrD() As String, c As Range, LR As Long, Cl As Range, LC As Integer
LR = Sheets("sheet1").Range("b" & Rows.Count).End(xlUp).Row
For Each c In Sheets("sheet1").Range("B2:B" & LR)
    ArrD = Split(c.Value, ",")
    For i = LBound(ArrD) To UBound(ArrD)
        For Each Cl In Sheets("sheet2").Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
            If CDate(Trim(ArrD(i))) = Cl.Value Then
                LC = Cells(Cl.Row, Columns.Count).End(xlToLeft).Column
                Cl.Offset(, LC).Value = c.Offset(, -1).Value
            End If
        Next Cl
    Next i
Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top